Skip to content

Commit a94ad02

Browse files
committed
Fixes over fixes for the ZULIP_SECRETS_*
1 parent cd75ef7 commit a94ad02

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

entrypoint.sh

+11-10
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,24 @@ databaseInitiation(){
9595
su zulip -c "/home/zulip/deployments/current/manage.py initialize_voyager_db" || :
9696
}
9797
secretsSetup(){
98-
local ZULIP_SECRETS="/etc/zulip/zulip-secrets.conf"
9998
local POSSIBLE_SECRETS=(
100-
"s3_key" "s3_secret_key" "android_gcm_api_key" "google_oauth2_client_secret"
101-
"dropbox_app_key" "mailchimp_api_key" "mandrill_api_key" "twitter_consumer_key" "twitter_consumer_secret"
102-
"twitter_access_token_key" "twitter_access_token_secret" "email_password" "rabbitmq_password"
99+
"email_password" "rabbitmq_password" "s3_key" "s3_secret_key" "android_gcm_api_key"
100+
"google_oauth2_client_secret" "dropbox_app_key" "mailchimp_api_key" "mandrill_api_key"
101+
"twitter_consumer_key" "twitter_consumer_secret" "twitter_access_token_key" "twitter_access_token_secret"
103102
)
104103
for SECRET_KEY in "${POSSIBLE_SECRETS[@]}"; do
105104
local KEY="ZULIP_SECRETS_$SECRET_KEY"
106105
local SECRET_VAR="${!KEY}"
107106
if [ -z "$SECRET_VAR" ]; then
108-
echo "No settings env var for key \"$SECRET_KEY\"."
107+
echo "No secret found for key \"$SECRET_KEY\"."
109108
continue
110109
fi
111110
echo "Setting secret \"$SECRET_KEY\"."
112-
if [ -z "$(grep "$SECRET_KEY" "$ZULIP_SECRETS")" ]; then
113-
sed -i -r "s~#?${SECRET_KEY}[ ]*=[ ]*['\"]+.*['\"]+$~${SECRET_KEY} = '${SECRET_VAR}'~g" "$ZULIP_SECRETS"
111+
if [ ! -z "$(grep "$SECRET_KEY" /etc/zulip/zulip-secrets.conf)" ]; then
112+
sed -i -r "s~#?${SECRET_KEY}[ ]*=[ ]*['\"]+.*['\"]+$~${SECRET_KEY} = '${SECRET_VAR}'~g" /etc/zulip/zulip-secrets.conf
114113
continue
115114
fi
116-
echo "$SECRET_KEY = '$SECRET_VAR'" >> "$ZULIP_SECRETS"
115+
echo "$SECRET_KEY = '$SECRET_VAR'" >> /etc/zulip/zulip-secrets.conf
117116
done
118117
unset SECRET_KEY
119118
}
@@ -267,8 +266,10 @@ chown zulip:zulip -R "$DATA_DIR/uploads"
267266
# Configure rabbitmq server everytime because it could be a new one ;)
268267
rabbitmqSetup
269268
echo "Generating and setting secrets ..."
270-
# Generate the secrets
271-
/root/zulip/scripts/setup/generate_secrets.py
269+
if [ ! -e "$DATA_DIR/.initiated" ]; then
270+
# Generate the secrets
271+
/root/zulip/scripts/setup/generate_secrets.py
272+
fi
272273
secretsSetup
273274
echo "Secrets generated and set."
274275
echo "Setting Zulip settings ..."

0 commit comments

Comments
 (0)