From d1743245b3567caf6a585b79add7abe542bd13a0 Mon Sep 17 00:00:00 2001 From: Benjamin Diaz Date: Tue, 5 Mar 2019 14:28:32 -0300 Subject: [PATCH] Adds support in entrypoint script for more complex mysql URI (+pool and query params) Change-Id: I71445bbd489b905cb796eff294997a83e4d4cb91 Signed-off-by: Benjamin Diaz --- docker/scripts/start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/scripts/start.sh b/docker/scripts/start.sh index fc0b3c3..8e2880b 100644 --- a/docker/scripts/start.sh +++ b/docker/scripts/start.sh @@ -37,11 +37,11 @@ function is_db_created() { } if [[ $OSMMON_SQL_DATABASE_URI == *'mysql'* ]]; then - DB_HOST=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@(.+):.*$|\1|') - DB_PORT=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^\w+://.*:([0-9]+).*$|\1|') - DB_USER=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^\w+://(.+):.+@.+$|\1|') + DB_HOST=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^.+://.+:.+@(.+):.*$|\1|') + DB_PORT=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^.+://.*:([0-9]+).*$|\1|') + DB_USER=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^.+://(.+):.+@.+$|\1|') DB_PASSWORD=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^.+://.+:(.+)@.*$|\1|') - DB_NAME=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@.+:.*/(.+)$|\1|') + DB_NAME=$(echo $OSMMON_SQL_DATABASE_URI | sed -r 's|^.+://.+:.+@.+:.*/(\w+)(\?.*)?$|\1|') wait_db "$DB_HOST" "$DB_PORT" || exit 1 -- 2.25.1