diff --git a/abra.sh b/abra.sh index edf3403..2bcd6ea 100644 --- a/abra.sh +++ b/abra.sh @@ -1,2 +1,2 @@ -export ENTRYPOINT_CONF_VERSION=v11 +export ENTRYPOINT_CONF_VERSION=v12 export PG_BACKUP_VERSION=v1 diff --git a/compose.postgresql.yml b/compose.postgresql.yml index de41691..591ee29 100644 --- a/compose.postgresql.yml +++ b/compose.postgresql.yml @@ -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 diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl index da23531..c506359 100644 --- a/entrypoint.sh.tmpl +++ b/entrypoint.sh.tmpl @@ -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