Skip to content

Fix appkey check + add helper #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ services:
- PGID=1000
- TZ=Etc/UTC
- APP_URL=
- APP_KEY=
- DB_HOST=
- DB_PORT=3306
- DB_USERNAME=
Expand All @@ -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= \
Expand All @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
3 changes: 3 additions & 0 deletions root/appkey
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

php /app/www/artisan key:generate --show
4 changes: 2 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down