From 5e83d1be5fb74e3bce5ab414bcc5b98709cd7ac9 Mon Sep 17 00:00:00 2001 From: Ian Clark Date: Fri, 4 Sep 2020 09:55:40 -0700 Subject: [PATCH] adding option to skip db create (#39) * adding option to skip db create * adding default value of false to SKIP_DB_CREATE Co-authored-by: Ian Clark --- pdns/docker-entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pdns/docker-entrypoint.sh b/pdns/docker-entrypoint.sh index 8e84933..f9512c8 100755 --- a/pdns/docker-entrypoint.sh +++ b/pdns/docker-entrypoint.sh @@ -29,7 +29,9 @@ until $MYSQL_COMMAND -e ';' ; do sleep 3 done -$MYSQL_COMMAND -e "CREATE DATABASE IF NOT EXISTS ${PDNS_gmysql_dbname}" +if [ "${SKIP_DB_CREATE:-false}" != 'true' ]; then + $MYSQL_COMMAND -e "CREATE DATABASE IF NOT EXISTS ${PDNS_gmysql_dbname}" +fi MYSQL_CHECK_IF_HAS_TABLE="SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '${PDNS_gmysql_dbname}';" MYSQL_NUM_TABLE=$($MYSQL_COMMAND --batch --skip-column-names -e "$MYSQL_CHECK_IF_HAS_TABLE")