let env vars be overwritten
This commit is contained in:
@@ -15,12 +15,17 @@ def connect_db() -> mysql.connector.MySQLConnection:
|
|||||||
|
|
||||||
Credential values are validated and an exception is raised if any are missing.
|
Credential values are validated and an exception is raised if any are missing.
|
||||||
"""
|
"""
|
||||||
load_dotenv()
|
load_dotenv(override=True)
|
||||||
host = os.getenv("DB_HOST")
|
host = os.getenv("DB_HOST")
|
||||||
user = os.getenv("DB_USER")
|
user = os.getenv("DB_USER")
|
||||||
password = os.getenv("DB_PASSWORD")
|
password = os.getenv("DB_PASSWORD")
|
||||||
database = os.getenv("DB_DATABASE")
|
database = os.getenv("DB_DATABASE")
|
||||||
|
|
||||||
|
print(host)
|
||||||
|
print(user)
|
||||||
|
print(password)
|
||||||
|
print(database)
|
||||||
|
|
||||||
if None in [host, user, password, database]:
|
if None in [host, user, password, database]:
|
||||||
raise DBException("Missing database credentials")
|
raise DBException("Missing database credentials")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user