From 9404909b335aedd3aaba34db5a7eb105f353ce33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luzzardi?= Date: Mon, 22 Aug 2022 10:25:52 -0300 Subject: [PATCH] issue #87 Update pull to get database credentials from the environment, use hardcoded only if not env not set. --- pull/pull | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pull/pull b/pull/pull index 810c55e..eccfcc8 100755 --- a/pull/pull +++ b/pull/pull @@ -189,10 +189,15 @@ provider_pull_db () echo-green "Pulling DB" - # Variables to set for local use. - local __db_user="${dbuser:-root}" - local __db_password="${dbpass:-root}" - local __db_database="${dbname:-default}" + # Get database environment variables. + DB_USER=${MYSQL_USER:-root} + DB_PASS=${MYSQL_PASSWORD:-root} + DB_NAME=${MYSQL_DATABASE:-default} + + # Variables to set for local use. + local __db_user="${dbuser:-${DB_USER}}" + local __db_password="${dbpass:-${DB_PASS}}" + local __db_database="${dbname:-${DB_NAME}}" # Set the db file that will be stored within the cli container local db_file="/tmp/${__db_database}.${hostingenv}.${hostingsite}.sql.gz"