diff --git a/bookstack/DOCS.md b/bookstack/DOCS.md index 36ed32b..f56a388 100644 --- a/bookstack/DOCS.md +++ b/bookstack/DOCS.md @@ -25,6 +25,9 @@ log_level: info ssl: false certfile: fullchain.pem keyfile: privkey.pem +envvars: + - name: SESSION_COOKIE_NAME + value: bookstack_session ``` **Note**: _This is just an example, don't copy and paste it! Create your own!_ @@ -91,6 +94,27 @@ 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: `envvars` + +This allows the setting of Environment Variables to control Bookstack +configuration as documented at: + + + +**Note**: _Changing these options can possibly cause issues with you instance. +USE AT YOUR OWN RISK!_ + +These are case sensitive and any items set by specific configuration will take +precedence. + +#### Sub-option: `name` + +The name of the environment variable to set. + +#### Sub-option: `value` + +The value of the environment variable to set. + ## Database usage By default, Bookstack will automatically use and configure the Home Assistant diff --git a/bookstack/config.json b/bookstack/config.json index b46ef70..66516e9 100644 --- a/bookstack/config.json +++ b/bookstack/config.json @@ -17,6 +17,7 @@ "80/tcp": "Web interface" }, "options": { + "envvars": [], "ssl": false, "certfile": "fullchain.pem", "keyfile": "privkey.pem" @@ -31,6 +32,12 @@ "log_level": "list(trace|debug|info|notice|warning|error|fatal)?", "certfile": "str", "keyfile": "str", - "ssl": "bool" + "ssl": "bool", + "envvars": [ + { + "name": "str", + "value": "str" + } + ] } } diff --git a/bookstack/rootfs/etc/services.d/php-fpm/run b/bookstack/rootfs/etc/services.d/php-fpm/run index 9065ec0..471ec9d 100644 --- a/bookstack/rootfs/etc/services.d/php-fpm/run +++ b/bookstack/rootfs/etc/services.d/php-fpm/run @@ -11,6 +11,13 @@ export DB_PASSWORD export DB_PORT export DB_USERNAME +for envvar in $(bashio::config 'envvars|keys'); do + name=$(bashio::config "envvars[${envvar}].name") + value=$(bashio::config "envvars[${envvar}].value") + bashio::log.debug "Setting Env Variable ${name} to ${value}" + export "${name}=${value}" +done + APP_KEY=$(cat /data/bookstack/appkey.txt) if bashio::config.has_value 'remote_mysql_host';then