Skip to content

✨ Add options for setting and displaying Appkey #136

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 3 commits into from
Sep 12, 2021
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
10 changes: 10 additions & 0 deletions bookstack/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ Only applies if a remote MYSQL database is used, the password of the above user.
Only applies if a remote MYSQL database is used, the port that the database
server is listening on.

### Option: `show_appkey`

If set to `true`, will show the currently configured appkey in the addon logs.
This should be recorded in case of a restore.

### Option: `appkey`

Allows the appkey to be defined by the user, in case of restoring from another
system. Will automatically be removed from config on first run if set.

### Option: `envvars`

This allows the setting of Environment Variables to control Bookstack
Expand Down
2 changes: 2 additions & 0 deletions bookstack/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"remote_mysql_username": "str?",
"remote_mysql_password": "password?",
"remote_mysql_port": "int?",
"show_appkey": "bool?",
"appkey": "str?",
"log_level": "list(trace|debug|info|notice|warning|error|fatal)?",
"certfile": "str",
"keyfile": "str",
Expand Down
7 changes: 7 additions & 0 deletions bookstack/rootfs/etc/cont-init.d/bookstack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,10 @@ if ! bashio::fs.file_exists "/data/bookstack/appkey.txt"; then
echo "${key}" > /data/bookstack/appkey.txt
bashio::log.info "App Key generated: ${key}"
fi

if bashio::config.has_value "appkey"; then
bashio::log.info "Setting appkey to user defined value"
key=$(bashio::config "appkey")
echo "${key}" > /data/bookstack/appkey.txt
bashio::addon.option 'appkey'
fi
5 changes: 5 additions & 0 deletions bookstack/rootfs/etc/services.d/php-fpm/run
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ done

APP_KEY=$(cat /data/bookstack/appkey.txt)

if bashio::config.true "show_appkey"; then
bashio::log.info "Your app key is currently set to:"
bashio::log.info "${APP_KEY}"
fi

if bashio::config.has_value 'remote_mysql_host';then
DB_HOST=$(bashio::config "remote_mysql_host")
DB_DATABASE=$(bashio::config "remote_mysql_database")
Expand Down