diff --git a/bash_functions.sh b/bash_functions.sh index 89de84a..f09db8e 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -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() { if [ -z "${WEBPASSWORD+x}" ] ; then # Not set at all, give the user a random pass diff --git a/start.sh b/start.sh index 9802985..815da70 100755 --- a/start.sh +++ b/start.sh @@ -42,6 +42,7 @@ docker_checks #fi fix_capabilities +load_web_password_secret generate_password validate_env || exit 1 prepare_configs