diff --git a/app/entrypoint.sh b/app/entrypoint.sh index 5b664fe..85e23a1 100644 --- a/app/entrypoint.sh +++ b/app/entrypoint.sh @@ -12,13 +12,20 @@ url="$(echo ${SYNC_TOKENSERVER_DATABASE_URL/$proto/})" userpass="$(echo $url | grep @ | cut -d@ -f1)" pass="$(echo $userpass | grep : | cut -d: -f2)" user="$(echo $userpass | grep : | cut -d: -f1)" -host="$(echo ${url/$user:$pass@/} | cut -d/ -f1)" -port="$(echo $host | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')" -host="$(echo ${host/:$port/} | cut -d/ -f1)" -db="$(echo $url | grep / | cut -d/ -f2-)" +hostport="$(echo ${url/$user:$pass@/} | cut -d/ -f1)" +port="$(echo $hostport | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')" +host="$(echo ${hostport/:$port/} | cut -d/ -f1)" +db="$(echo $url | grep / | cut -d/ -f2 | cut -d? -f1)" +IFS="&" read -ra options <<< $(echo $url | grep ? | cut -d? -f2) +for option in "${options[@]}" +do + declare "$(echo $option | cut -d= -f1)=$(echo $option | cut -d= -f2)" +done # Create service and node if they doesnt exist -mysql $db -h $host -P $port -u $user -p"$pass" < /config/local.toml <