From d4a1635456ef7e4ae1f643553d827cd1b9145d6f Mon Sep 17 00:00:00 2001 From: Benjamin Diaz Date: Mon, 11 Mar 2019 13:36:34 -0300 Subject: [PATCH] Adds support in entrypoint script for more complex mysql URI (+pool and query params) Change-Id: Iab6bd86196d9b0bf330eac6b053fdda5dc021328 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 04d0d34..3209824 100644 --- a/docker/scripts/start.sh +++ b/docker/scripts/start.sh @@ -37,11 +37,11 @@ function is_db_created() { } if [[ $OSMPOL_SQL_DATABASE_URI == *'mysql'* ]]; then - DB_HOST=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@(.+):.*$|\1|') - DB_PORT=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://.*:([0-9]+).*$|\1|') - DB_USER=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://(.+):.+@.+$|\1|') + DB_HOST=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^.+://.+:.+@(.+):.*$|\1|') + DB_PORT=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^.+://.*:([0-9]+).*$|\1|') + DB_USER=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^.+://(.+):.+@.+$|\1|') DB_PASSWORD=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^.+://.+:(.+)@.*$|\1|') - DB_NAME=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^\w+://.+:.+@.+:.*/(.+)$|\1|') + DB_NAME=$(echo $OSMPOL_SQL_DATABASE_URI | sed -r 's|^.+://.+:.+@.+:.*/(\w+)(\?.*)?$|\1|') wait_db "$DB_HOST" "$DB_PORT" || exit 1 -- 2.25.1