fix: prevent unbound variable error
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
f
2025-04-10 09:30:31 -03:00
parent 58bfa65b8a
commit d0191f1c49
3 changed files with 9 additions and 7 deletions

View File

@ -1,2 +1,2 @@
export ENTRYPOINT_CONF_VERSION=v11
export ENTRYPOINT_CONF_VERSION=v12
export PG_BACKUP_VERSION=v1

View File

@ -2,7 +2,6 @@ version: "3.8"
services:
app:
environment:
- POSTGRES_ENABLED=1
- CMD_DB_NAME=codimd
- CMD_DB_USER=codimd
- CMD_DB_HOST=db

View File

@ -22,13 +22,15 @@ file_env() {
}
load_vars() {
file_env "CMD_DB_PASSWORD"
if [ -n "${CMD_DB_PASSWORD}" ] ; then
file_env "CMD_DB_PASSWORD"
fi
file_env "CMD_OAUTH2_CLIENT_SECRET"
file_env "CMD_SESSION_SECRET"
}
main() {
set -eu
set -e
load_vars
mkdir -p "/hedgedoc/.npm" && \
@ -40,8 +42,9 @@ main() {
main
if [ -n "$POSTGRES_ENABLED" ]; then
export CMD_DB_URL="postgres://$CMD_DB_USER:$CMD_DB_PASSWORD@$CMD_DB_HOST:5432/$CMD_DB_NAME"
if [ -z "${CMD_DB_URL}" ] ; then
# TODO: support databases other than postgres and sqlite
export CMD_DB_URL="${postgres://$CMD_DB_USER:$CMD_DB_PASSWORD@$CMD_DB_HOST:5432/$CMD_DB_NAME}"
fi
# 3wc: `source /docker-entrypoint.sh -e` to load CMD_DB_URL for CLI scripts
@ -52,4 +55,4 @@ if [ ! "${1-}" == "-e" ]; then
/usr/local/bin/docker-entrypoint.sh npm start
fi
set +eu
set +e