From 9c61389830acaf841d1092a52314e1b520fdcf06 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Fri, 19 Jul 2019 14:36:23 +0200 Subject: [PATCH] :sparkles: Init DB JDBC URI from base DB params Signed-off-by: mathieu.brunot --- README.md | 1 + docker/backend/entrypoint.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 7481685ad..c05488b7f 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ Available at runtime: - `-e UXBOX_HTTP_SERVER_DEBUG=...` (defaults to `true`) - `-e UXBOX_DATABASE_USERNAME="..."` (defaults to `nil`) - `-e UXBOX_DATABASE_PASSWORD="..."` (defaults to `nil`) +- `-e UXBOX_DATABASE_URI="..."` (defaults to ` `, will be computed based on other DATABASE parameters if empty) - `-e UXBOX_DATABASE_NAME="..."` (defaults to `"uxbox"`) - `-e UXBOX_DATABASE_SERVER="..."` (defaults to `"localhost"`) - `-e UXBOX_DATABASE_PORT=...` (defaults to `5432`) diff --git a/docker/backend/entrypoint.sh b/docker/backend/entrypoint.sh index 9e45fe9f1..64e24f6ce 100644 --- a/docker/backend/entrypoint.sh +++ b/docker/backend/entrypoint.sh @@ -4,5 +4,11 @@ set -e echo "Synchronize static data..." rsync -avr --delete ./resources/public/static/ ./data/static/ +if [ -z "$UXBOX_DATABASE_URI" ]; then + echo "Initializing database connection string..." + UXBOX_DATABASE_URI="\"jdbc:postgresql://$(echo ${UXBOX_DATABASE_SERVER} | tr -d '"'):${UXBOX_DATABASE_PORT}/$(echo ${UXBOX_DATABASE_NAME} | tr -d '"')\"" + echo "Database connection string: $UXBOX_DATABASE_URI" +fi + echo "Setting up UXBOX Backend..." exec "$@"