Skip to content

Commit 52b2b2d

Browse files
committed
entrypoint: Support SECRETS_something_FILE set to a path.
1 parent 706f763 commit 52b2b2d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

entrypoint.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ secretsConfiguration() {
276276
[[ "$key" == SECRETS_*([0-9A-Z_a-z-]) ]] || continue
277277
local SECRET_KEY="${key#SECRETS_}"
278278
local SECRET_VAR="${!key}"
279+
if [[ "$SECRET_KEY" == *"_FILE" ]]; then
280+
SECRET_VAR="$(cat "$SECRET_VAR")"
281+
SECRET_KEY="${SECRET_KEY%_FILE}"
282+
fi
279283
if [ -z "$SECRET_VAR" ]; then
280284
echo "Empty secret for key \"$SECRET_KEY\"."
281285
fi
@@ -416,7 +420,9 @@ initialConfiguration() {
416420
waitingForDatabase() {
417421
local TIMEOUT=60
418422
echo "Waiting for database server to allow connections ..."
419-
while ! PGPASSWORD="${SECRETS_postgres_password?}" /usr/bin/pg_isready -h "$DB_HOST" -p "$DB_HOST_PORT" -U "$DB_USER" -t 1 >/dev/null 2>&1; do
423+
local PGPASSWORD
424+
PGPASSWORD="$(crudini --get /etc/zulip/zulip-secrets.conf secrets postgres_password)"
425+
while ! PGPASSWORD="$PGPASSWORD" /usr/bin/pg_isready -h "$DB_HOST" -p "$DB_HOST_PORT" -U "$DB_USER" -t 1 >/dev/null 2>&1; do
420426
if ! ((TIMEOUT--)); then
421427
echo "Could not connect to database server. Exiting."
422428
exit 1

0 commit comments

Comments
 (0)