Skip to content

Commit 4933ea9

Browse files
authored
✨ Add envvars option to configuration (#32)
* ✨ Add envvar option * 📚 Update docs for new option * ✏ Fix linting * ✏ Linting for Prettier
1 parent 0423521 commit 4933ea9

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

bookstack/DOCS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ log_level: info
2525
ssl: false
2626
certfile: fullchain.pem
2727
keyfile: privkey.pem
28+
envvars:
29+
- name: SESSION_COOKIE_NAME
30+
value: bookstack_session
2831
```
2932
3033
**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.
9194
Only applies if a remote MYSQL database is used, the port that the database
9295
server is listening on.
9396

97+
### Option: `envvars`
98+
99+
This allows the setting of Environment Variables to control Bookstack
100+
configuration as documented at:
101+
102+
<https://www.bookstackapp.com/docs/>
103+
104+
**Note**: _Changing these options can possibly cause issues with you instance.
105+
USE AT YOUR OWN RISK!_
106+
107+
These are case sensitive and any items set by specific configuration will take
108+
precedence.
109+
110+
#### Sub-option: `name`
111+
112+
The name of the environment variable to set.
113+
114+
#### Sub-option: `value`
115+
116+
The value of the environment variable to set.
117+
94118
## Database usage
95119

96120
By default, Bookstack will automatically use and configure the Home Assistant

bookstack/config.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"80/tcp": "Web interface"
1818
},
1919
"options": {
20+
"envvars": [],
2021
"ssl": false,
2122
"certfile": "fullchain.pem",
2223
"keyfile": "privkey.pem"
@@ -31,6 +32,12 @@
3132
"log_level": "list(trace|debug|info|notice|warning|error|fatal)?",
3233
"certfile": "str",
3334
"keyfile": "str",
34-
"ssl": "bool"
35+
"ssl": "bool",
36+
"envvars": [
37+
{
38+
"name": "str",
39+
"value": "str"
40+
}
41+
]
3542
}
3643
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ export DB_PASSWORD
1111
export DB_PORT
1212
export DB_USERNAME
1313

14+
for envvar in $(bashio::config 'envvars|keys'); do
15+
name=$(bashio::config "envvars[${envvar}].name")
16+
value=$(bashio::config "envvars[${envvar}].value")
17+
bashio::log.debug "Setting Env Variable ${name} to ${value}"
18+
export "${name}=${value}"
19+
done
20+
1421
APP_KEY=$(cat /data/bookstack/appkey.txt)
1522

1623
if bashio::config.has_value 'remote_mysql_host';then

0 commit comments

Comments
 (0)