diff --git a/README.md b/README.md index 8330609..2da64fd 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ services: - PGID=1000 - TZ=Etc/UTC - APP_URL= + - APP_KEY= - DB_HOST= - DB_PORT=3306 - DB_USERNAME= @@ -138,6 +139,7 @@ docker run -d \ -e PGID=1000 \ -e TZ=Etc/UTC \ -e APP_URL= \ + -e APP_KEY= \ -e DB_HOST= \ -e DB_PORT=3306 \ -e DB_USERNAME= \ @@ -161,6 +163,7 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | | `-e APP_URL=` | The IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com` | +| `-e APP_KEY=` | Session encryption key. Can be generated with `docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey` | | `-e DB_HOST=` | The database instance hostname | | `-e DB_PORT=3306` | Database port (default `3306`) | | `-e DB_USERNAME=` | Database user | diff --git a/readme-vars.yml b/readme-vars.yml index 3cc7bce..5c3f77d 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -25,6 +25,7 @@ param_volumes: param_usage_include_env: true param_env_vars: - { env_var: "APP_URL", env_value: "", desc: "The IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com`"} + - { env_var: "APP_KEY", env_value: "", desc: "Session encryption key. Can be generated with `docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey`"} - { env_var: "DB_HOST", env_value: "", desc: "The database instance hostname" } - { env_var: "DB_PORT", env_value: "3306", desc: "Database port (default `3306`)" } - { env_var: "DB_USERNAME", env_value: "", desc: "Database user" } diff --git a/root/appkey b/root/appkey new file mode 100755 index 0000000..2e689f6 --- /dev/null +++ b/root/appkey @@ -0,0 +1,3 @@ +#!/bin/bash + +php /app/www/artisan key:generate --show diff --git a/root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run b/root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run index ffabb69..8278406 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run @@ -46,9 +46,9 @@ fi # Check for app key if [[ -z ${APP_KEY} ]]; then - if ! grep -qE "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /app/www/.env 2> /dev/null; then + if ! grep -qE "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /app/www/.env 2> /dev/null || grep -qE "APP_KEY=SomeRandomString" /app/www/.env 2> /dev/null; then echo "An application key is missing, halting init!" - echo "You can generate a key with: docker exec -it bookstack php /app/www/artisan key:generate --show" + echo "You can generate a key with: docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey" sleep infinity fi fi