Skip to content

Commit c845170

Browse files
committed
Fix appkey check + add helper
1 parent 2c3eb82 commit c845170

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ services:
116116
- PGID=1000
117117
- TZ=Etc/UTC
118118
- APP_URL=
119+
- APP_KEY=
119120
- DB_HOST=
120121
- DB_PORT=3306
121122
- DB_USERNAME=
@@ -138,6 +139,7 @@ docker run -d \
138139
-e PGID=1000 \
139140
-e TZ=Etc/UTC \
140141
-e APP_URL= \
142+
-e APP_KEY= \
141143
-e DB_HOST= \
142144
-e DB_PORT=3306 \
143145
-e DB_USERNAME= \
@@ -161,6 +163,7 @@ Containers are configured using parameters passed at runtime (such as those abov
161163
| `-e PGID=1000` | for GroupID - see below for explanation |
162164
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
163165
| `-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` |
166+
| `-e APP_KEY=` | Session encryption key. Can be generated with `docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey` |
164167
| `-e DB_HOST=` | The database instance hostname |
165168
| `-e DB_PORT=3306` | Database port (default `3306`) |
166169
| `-e DB_USERNAME=` | Database user |

Diff for: readme-vars.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ param_volumes:
2525
param_usage_include_env: true
2626
param_env_vars:
2727
- { 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`"}
28+
- { 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`"}
2829
- { env_var: "DB_HOST", env_value: "", desc: "The database instance hostname" }
2930
- { env_var: "DB_PORT", env_value: "3306", desc: "Database port (default `3306`)" }
3031
- { env_var: "DB_USERNAME", env_value: "", desc: "Database user" }

Diff for: root/appkey

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
php /app/www/artisan key:generate --show

Diff for: root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ fi
4646

4747
# Check for app key
4848
if [[ -z ${APP_KEY} ]]; then
49-
if ! grep -qE "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /app/www/.env 2> /dev/null; then
49+
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
5050
echo "An application key is missing, halting init!"
51-
echo "You can generate a key with: docker exec -it bookstack php /app/www/artisan key:generate --show"
51+
echo "You can generate a key with: docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey"
5252
sleep infinity
5353
fi
5454
fi

0 commit comments

Comments
 (0)