Added 'WEBPASSWORD_FILE' environment variable to enable support for Docker Secrets.
If 'WEBPASSWORD' is set, 'WEBPASSWORD_FILE' is ignored. If 'WEBPASSWORD' is empty, and 'WEBPASSWORD_FILE' is set to a valid readable file, then 'WEBPASSWORD' will be set to the contents of 'WEBPASSWORD_FILE'. Signed-off-by: Daniel <daniel@developerdan.com>
This commit is contained in:
parent
76d2578b77
commit
64892423b6
|
@ -290,6 +290,14 @@ setup_web_port() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
load_web_password_secret() {
|
||||||
|
# If WEBPASSWORD is not set at all, attempt to read password from WEBPASSWORD_FILE,
|
||||||
|
# allowing secrets to be passed via docker secrets
|
||||||
|
if [ -z "${WEBPASSWORD+x}" ] && [ -n "${WEBPASSWORD_FILE}" ] && [ -r "${WEBPASSWORD_FILE}" ]; then
|
||||||
|
WEBPASSWORD=$(<"${WEBPASSWORD_FILE}")
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
||||||
generate_password() {
|
generate_password() {
|
||||||
if [ -z "${WEBPASSWORD+x}" ] ; then
|
if [ -z "${WEBPASSWORD+x}" ] ; then
|
||||||
# Not set at all, give the user a random pass
|
# Not set at all, give the user a random pass
|
||||||
|
|
Loading…
Reference in New Issue