From 5ba7d609c2b188018f97a5d81bac9d806d12b272 Mon Sep 17 00:00:00 2001 From: mennamamdouh Date: Thu, 4 May 2023 19:21:06 +0300 Subject: [PATCH] edited the connect file to contain the information of the connection as environment variables -fixes #6 --- ecommerce-website/components/connect.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ecommerce-website/components/connect.php b/ecommerce-website/components/connect.php index 3323836..ca64274 100644 --- a/ecommerce-website/components/connect.php +++ b/ecommerce-website/components/connect.php @@ -1,9 +1,18 @@ load(); + +$database_host = $_ENV['DATABASE_HOST']; +$database_port = $_ENV['DATABASE_PORT']; +$database_user = $_ENV['DATABASE_USER']; +$database_password = $_ENV['DATABASE_PASSWORD']; +$database_name = $_ENV['DATABASE_NAME']; + +$dsn = "pgsql:host=$database_host;port=$database_port;dbname=$database_name"; + +$conn = new PDO($dsn, $database_user, $database_password); ?> \ No newline at end of file