From 9f89471befd328cc28375ef44a89e0444ece6a76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Luzzardi?= <andre.luzzardi@imagexmedia.com>
Date: Mon, 22 Aug 2022 10:25:52 -0300
Subject: [PATCH] issue #87 Update pull to get database credentials from
 enviroment, 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..a9e6919 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"