Skip to content

Commit 838a020

Browse files
authored
Merge pull request #1750 from pi-hole/password_file
Reintroduce missed docker secret handling (Redo)
2 parents 9b34ece + 9a2e3c6 commit 838a020

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ To explicitly set no password, set `FTLCONF_webserver_api_password: ''`.
138138
| `FTLCONF_[SETTING]` | unset | As per documentation | Customize pihole.toml with settings described in the [API Documentation](https://docs.pi-hole.net/api).<br><br>Replace `.` with `_`, e.g for `dns.dnssec=true` use `FTLCONF_dns_dnssec: 'true'`.<br/>Array type configs should be delimited with `;`.|
139139
| `PIHOLE_UID` | `1000` | Number | Overrides image's default pihole user id to match a host user id.<br/>**IMPORTANT**: id must not already be in use inside the container!|
140140
| `PIHOLE_GID` | `1000` | Number | Overrides image's default pihole group id to match a host group id.<br/>**IMPORTANT**: id must not already be in use inside the container!|
141+
| `WEBPASSWORD_FILE` | unset| `<Docker secret path>` | Set an Admin password using [Docker secrets](https://docs.docker.com/engine/swarm/secrets/). If `FTLCONF_webserver_api_password` is set, `WEBPASSWORD_FILE` is ignored. If `FTLCONF_webserver_api_password` is empty, and `WEBPASSWORD_FILE` is set to a valid readable file path, then `FTLCONF_webserver_api_password` will be set to the contents of `WEBPASSWORD_FILE`. |
141142

142143
### Advanced Variables
143144

src/bash_functions.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ migrate_v5_configs() {
189189
}
190190

191191
setup_web_password() {
192+
if [ -z "${FTLCONF_webserver_api_password+x}" ] && [ -n "${WEBPASSWORD_FILE}" ] && [ -r "${WEBPASSWORD_FILE}" ]; then
193+
echo " [i] Setting FTLCONF_webserver_api_password from file"
194+
export FTLCONF_webserver_api_password=$(<"${WEBPASSWORD_FILE}")
195+
fi
196+
192197
# If FTLCONF_webserver_api_password is not set
193198
if [ -z "${FTLCONF_webserver_api_password+x}" ]; then
194199
# Is this already set to something other than blank (default) in FTL's config file? (maybe in a volume mount)

0 commit comments

Comments
 (0)