File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -120,12 +120,6 @@ services:
120120 SETTING_MEMCACHED_LOCATION : " memcached:11211"
121121 SETTING_RABBITMQ_HOST : " rabbitmq"
122122 SETTING_REDIS_HOST : " redis"
123- SECRETS_postgres_password_FILE : /run/secrets/zulip__postgres_password
124- SECRETS_memcached_password_FILE : /run/secrets/zulip__memcached_password
125- SECRETS_rabbitmq_password_FILE : /run/secrets/zulip__rabbitmq_password
126- SECRETS_redis_password_FILE : /run/secrets/zulip__redis_password
127- SECRETS_secret_key_FILE : /run/secrets/zulip__secret_key
128- SECRETS_email_password_FILE : /run/secrets/zulip__email_password
129123 SETTING_EXTERNAL_HOST : " localhost.localdomain"
130124 SETTING_ZULIP_ADMINISTRATOR : " admin@example.com"
131125 SETTING_EMAIL_HOST : " " # e.g. smtp.example.com
Original file line number Diff line number Diff line change @@ -289,6 +289,24 @@ secretsConfiguration() {
289289 echo " Setting $SECRET_KEY from environment variable $key "
290290 crudini --set " $DATA_DIR /zulip-secrets.conf" " secrets" " ${SECRET_KEY} " " ${SECRET_VAR} "
291291 done
292+ # Secrets detected in /run/secrets/ override those via env vars
293+ shopt -s nullglob
294+ local secrets_path
295+ for secrets_path in /run/secrets/zulip__* ; do
296+ local secrets_filename
297+ secrets_filename=" $( basename " $secrets_path " ) "
298+ local SECRET_KEY=" ${secrets_filename# zulip__} "
299+ local SECRET_VAR
300+ SECRET_VAR=" $( cat " $secrets_path " ) "
301+ if [ -z " $SECRET_VAR " ]; then
302+ echo " Empty secret for key \" $SECRET_KEY \" ."
303+ elif [[ " $SECRET_VAR " =~ $' \n ' ]]; then
304+ echo " ERROR: Secret \" $SECRET_KEY \" contains a newline!"
305+ exit 1
306+ fi
307+ echo " Setting $SECRET_KEY from secret in $secrets_path "
308+ crudini --set " $DATA_DIR /zulip-secrets.conf" " secrets" " ${SECRET_KEY} " " ${SECRET_VAR} "
309+ done
292310 echo " Zulip secrets configuration succeeded."
293311}
294312databaseConfiguration () {
You can’t perform that action at this time.
0 commit comments