let env vars be overwritten

This commit is contained in:
Lucas Jensen
2025-01-15 17:52:14 -08:00
parent fb305e5509
commit a961118f77

View File

@@ -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")