Skip to content

Commit

Permalink
✨ Add envvars option to configuration (#32)
Browse files Browse the repository at this point in the history
* ✨ Add envvar option

* 📚 Update docs for new option

* ✏ Fix linting

* ✏ Linting for Prettier
  • Loading branch information
sinclairpaul authored Jan 20, 2021
1 parent 0423521 commit 4933ea9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
24 changes: 24 additions & 0 deletions bookstack/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!_
Expand Down Expand Up @@ -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:

<https://www.bookstackapp.com/docs/>

**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
Expand Down
9 changes: 8 additions & 1 deletion bookstack/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"80/tcp": "Web interface"
},
"options": {
"envvars": [],
"ssl": false,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
Expand All @@ -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"
}
]
}
}
7 changes: 7 additions & 0 deletions bookstack/rootfs/etc/services.d/php-fpm/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4933ea9

Please sign in to comment.