Skip to content

Commit a726c16

Browse files
committed
entrypoint: setConfigurationValue is only ever used with $SETTINGS_PY as the file.
1 parent 563eb41 commit a726c16

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

entrypoint.sh

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,9 @@ setConfigurationValue() {
101101
echo "No KEY given for setConfigurationValue."
102102
return 1
103103
fi
104-
if [ -z "$3" ]; then
105-
echo "No FILE given for setConfigurationValue."
106-
return 1
107-
fi
108104
local KEY="$1"
109105
local VALUE
110-
local FILE="$3"
111-
local TYPE="$4"
106+
local TYPE="$3"
112107
if [ -z "$TYPE" ]; then
113108
case "$2" in
114109
[Tt][Rr][Uu][Ee] | [Ff][Aa][Ll][Ss][Ee] | [Nn]one)
@@ -141,8 +136,8 @@ setConfigurationValue() {
141136
VALUE="$KEY = '${2//\'/\'}'"
142137
;;
143138
esac
144-
echo "$VALUE" >>"$FILE"
145-
echo "Setting key \"$KEY\", type \"$TYPE\" in file \"$FILE\"."
139+
echo "$VALUE" >>"$SETTINGS_PY"
140+
echo "Setting key \"$KEY\", type \"$TYPE\"."
146141
}
147142
nginxConfiguration() {
148143
echo "Executing nginx configuration ..."
@@ -280,9 +275,9 @@ secretsConfiguration() {
280275
}
281276
databaseConfiguration() {
282277
echo "Setting database configuration ..."
283-
setConfigurationValue "REMOTE_POSTGRES_HOST" "$DB_HOST" "$SETTINGS_PY" "string"
284-
setConfigurationValue "REMOTE_POSTGRES_PORT" "$DB_HOST_PORT" "$SETTINGS_PY" "string"
285-
setConfigurationValue "REMOTE_POSTGRES_SSLMODE" "$REMOTE_POSTGRES_SSLMODE" "$SETTINGS_PY" "string"
278+
setConfigurationValue "REMOTE_POSTGRES_HOST" "$DB_HOST" "string"
279+
setConfigurationValue "REMOTE_POSTGRES_PORT" "$DB_HOST_PORT" "string"
280+
setConfigurationValue "REMOTE_POSTGRES_SSLMODE" "$REMOTE_POSTGRES_SSLMODE" "string"
286281
# The password will be set in secretsConfiguration
287282
echo "Database configuration succeeded."
288283
}
@@ -293,10 +288,10 @@ authenticationBackends() {
293288
IFS=, read -r -a auth_backends <<<"$ZULIP_AUTH_BACKENDS"
294289
for AUTH_BACKEND in "${auth_backends[@]}"; do
295290
if [ "$FIRST" = true ]; then
296-
setConfigurationValue "AUTHENTICATION_BACKENDS" "('zproject.backends.${AUTH_BACKEND//\'/\'}',)" "$SETTINGS_PY" "array"
291+
setConfigurationValue "AUTHENTICATION_BACKENDS" "('zproject.backends.${AUTH_BACKEND//\'/\'}',)" "array"
297292
FIRST=false
298293
else
299-
setConfigurationValue "AUTHENTICATION_BACKENDS += ('zproject.backends.${AUTH_BACKEND//\'/\'}',)" "" "$SETTINGS_PY" "literal"
294+
setConfigurationValue "AUTHENTICATION_BACKENDS += ('zproject.backends.${AUTH_BACKEND//\'/\'}',)" "" "literal"
300295
fi
301296
echo "Adding authentication backend \"$AUTH_BACKEND\"."
302297
done
@@ -348,7 +343,7 @@ zulipConfiguration() {
348343
|| [ "$setting_key" = "EXTERNAL_HOST" ]; then
349344
type="string"
350345
fi
351-
setConfigurationValue "$setting_key" "$setting_var" "$SETTINGS_PY" "$type"
346+
setConfigurationValue "$setting_key" "$setting_var" "$type"
352347
done
353348
if ! su zulip -c "/home/zulip/deployments/current/manage.py checkconfig"; then
354349
echo "Error in the Zulip configuration. Exiting."

0 commit comments

Comments
 (0)