Merge pull request #584 from lightswitch05/feature/support-docker-secrets-for-web-password

Support docker secrets for web password
This commit is contained in:
Adam Hill 2020-02-27 14:30:16 -06:00 committed by GitHub
commit e6a9cd5ce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -42,6 +42,7 @@ docker_checks
#fi
fix_capabilities
load_web_password_secret
generate_password
validate_env || exit 1
prepare_configs