diff --git a/src/__pycache__/config.cpython-311.pyc b/src/__pycache__/config.cpython-311.pyc index 0c2a580..75cf140 100644 Binary files a/src/__pycache__/config.cpython-311.pyc and b/src/__pycache__/config.cpython-311.pyc differ diff --git a/src/config.py b/src/config.py index ae94b7a..74e8b66 100644 --- a/src/config.py +++ b/src/config.py @@ -33,18 +33,15 @@ def get_env_tags(tag_list: List[str]) -> dict: def get_config(): - try: - # Try to load from .env file in the project root - project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) - env_path = os.path.join(project_root, ".env") - - if os.path.exists(env_path): - config = Config(env_path) - else: - # Fallback to default behavior (current working directory) - config = Config(".env") - - except FileNotFoundError: + # Try to load from .env file in the project root + project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + env_path = os.path.join(project_root, ".env") + + if os.path.exists(env_path): + config = Config(env_path) + elif os.path.exists(".env"): + config = Config(".env") + else: # If .env doesn't exist, use environment variables config = Config(environ=os.environ) diff --git a/src/modules/config.py b/src/modules/config.py index a183abf..a1ebfa0 100644 --- a/src/modules/config.py +++ b/src/modules/config.py @@ -13,8 +13,8 @@ def get_production_connection(): dbname="digital_twin", user="digital_twin", password="Pr0jec7@D!g!tTwiN", - host={COLLECTOR_HOSTNAME}, - port={COLLECTOR_PORT}, + host=COLLECTOR_HOSTNAME, + port=COLLECTOR_PORT, ) return production_connection except Exception as e: @@ -36,15 +36,15 @@ def get_connection(): dbname="digital_twin", user="postgres", password="postgres", - host={DATABASE_HOSTNAME}, - port={DATABASE_PORT}, + host=DATABASE_HOSTNAME, + port=DATABASE_PORT, ) connection_wo_db = psycopg2.connect( dbname="digital_twin", user="postgres", password="postgres", - host={COLLECTOR_HOSTNAME}, - port={COLLECTOR_PORT}, + host=COLLECTOR_HOSTNAME, + port=COLLECTOR_PORT, ) return connection, connection_wo_db except Exception as e: