From: Guillaume Pellerin Date: Mon, 23 Oct 2017 09:08:16 +0000 (+0200) Subject: Just use env variable to select DB mode X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9fe3298f07f619647d26b5ccb0857c0aded621b2;p=docker-django-scripts.git Just use env variable to select DB mode --- diff --git a/db/restore.sh b/db/restore.sh index 94ba8c3..7d20816 100755 --- a/db/restore.sh +++ b/db/restore.sh @@ -1,14 +1,14 @@ #!/bin/bash # import dump functions of the database (postgres or mysql) -export POSTGRES="$(dpkg --get-selections | grep postgres 2>&1)" -export MYSQL="$(dpkg --get-selections | grep mysql 2>&1)" +# export POSTGRES="$(dpkg --get-selections | grep postgres 2>&1)" +# export MYSQL="$(dpkg --get-selections | grep mysql 2>&1)" -if [ ! -z "$MYSQL" ]; +if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then export MYSQL_PWD=$MYSQL_ROOT_PASSWORD mysql -h db $MYSQL_DATABASE -uroot < /srv/backup/mariadb.dump -elif [ ! -z "$POSTGRES" ]; +elif [ ! -z "$POSTGRES_PASSWORD" ]; then export PGUSER="postgres" export PGPASSWORD=$POSTGRES_PASSWORD