Skip to content

Commit c8f542a

Browse files
authored
✨ Add options for setting and displaying Appkey (#136)
* ✨ Add show_appkey option * ✨ Add ability to set appkey on startup * 📚 Update Documentation for new options
1 parent a33fdf7 commit c8f542a

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

bookstack/DOCS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ Only applies if a remote MYSQL database is used, the password of the above user.
8989
Only applies if a remote MYSQL database is used, the port that the database
9090
server is listening on.
9191

92+
### Option: `show_appkey`
93+
94+
If set to `true`, will show the currently configured appkey in the addon logs.
95+
This should be recorded in case of a restore.
96+
97+
### Option: `appkey`
98+
99+
Allows the appkey to be defined by the user, in case of restoring from another
100+
system. Will automatically be removed from config on first run if set.
101+
92102
### Option: `envvars`
93103

94104
This allows the setting of Environment Variables to control Bookstack

bookstack/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
"remote_mysql_username": "str?",
2828
"remote_mysql_password": "password?",
2929
"remote_mysql_port": "int?",
30+
"show_appkey": "bool?",
31+
"appkey": "str?",
3032
"log_level": "list(trace|debug|info|notice|warning|error|fatal)?",
3133
"certfile": "str",
3234
"keyfile": "str",

bookstack/rootfs/etc/cont-init.d/bookstack.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,10 @@ if ! bashio::fs.file_exists "/data/bookstack/appkey.txt"; then
8686
echo "${key}" > /data/bookstack/appkey.txt
8787
bashio::log.info "App Key generated: ${key}"
8888
fi
89+
90+
if bashio::config.has_value "appkey"; then
91+
bashio::log.info "Setting appkey to user defined value"
92+
key=$(bashio::config "appkey")
93+
echo "${key}" > /data/bookstack/appkey.txt
94+
bashio::addon.option 'appkey'
95+
fi

bookstack/rootfs/etc/services.d/php-fpm/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ done
2020

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

23+
if bashio::config.true "show_appkey"; then
24+
bashio::log.info "Your app key is currently set to:"
25+
bashio::log.info "${APP_KEY}"
26+
fi
27+
2328
if bashio::config.has_value 'remote_mysql_host';then
2429
DB_HOST=$(bashio::config "remote_mysql_host")
2530
DB_DATABASE=$(bashio::config "remote_mysql_database")

0 commit comments

Comments
 (0)