Add .env file for configuration, update db connection to use environment variables, and enhance requirements
This commit is contained in:
@@ -2,7 +2,6 @@ import mariadb
|
||||
import logging
|
||||
|
||||
|
||||
|
||||
#Logging
|
||||
|
||||
logging.basicConfig(
|
||||
@@ -18,14 +17,14 @@ except Exception as e:
|
||||
logging.exception('An error occurred')
|
||||
|
||||
|
||||
def connect():
|
||||
def connect(db_user, db_psswd, db_host, db_port, db_name):
|
||||
try:
|
||||
global connection
|
||||
connection = mariadb.connect(user="luggage",
|
||||
password="13579,QsC",
|
||||
host="192.168.1.74",
|
||||
port=3307,
|
||||
database="canada_luggage")
|
||||
connection = mariadb.connect(user=db_user,
|
||||
password=db_psswd,
|
||||
host=db_host,
|
||||
port=db_port,
|
||||
database=db_name)
|
||||
print("Connected to MariaDB successfully!")
|
||||
logging.info("Connected to MariaDB successfully!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user