Skip to content

Commit

Permalink
✨ Add options for setting and displaying Appkey (#136)
Browse files Browse the repository at this point in the history
* ✨ Add show_appkey option

* ✨ Add ability to set appkey on startup

* 📚 Update Documentation for new options
  • Loading branch information
sinclairpaul authored Sep 12, 2021
1 parent a33fdf7 commit c8f542a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
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

0 comments on commit c8f542a

Please sign in to comment.