Adds support in entrypoint script for more complex mysql URI (+pool and query params) 80/7280/1
authorBenjamin Diaz <bdiaz@whitestack.com>
Tue, 5 Mar 2019 17:28:32 +0000 (14:28 -0300)
committerBenjamin Diaz <bdiaz@whitestack.com>
Tue, 5 Mar 2019 17:28:32 +0000 (14:28 -0300)
Change-Id: I71445bbd489b905cb796eff294997a83e4d4cb91
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
docker/scripts/start.sh

index fc0b3c3..8e2880b 100644 (file)
@@ -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