From 44a154c38de26198530b58836224b840fba597e9 Mon Sep 17 00:00:00 2001 From: MrWaradana Date: Fri, 9 Jan 2026 15:21:39 +0700 Subject: [PATCH] fix dynamic env database hostname and port --- src/modules/config.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/modules/config.py b/src/modules/config.py index 68ea4ec..f2666a2 100644 --- a/src/modules/config.py +++ b/src/modules/config.py @@ -1,4 +1,5 @@ import psycopg2 +from src.config import DATABASE_HOSTNAME, DATABASE_PORT, COLLECTOR_HOSTNAME, COLLECTOR_PORT def get_production_connection(): try: @@ -7,8 +8,8 @@ def get_production_connection(): dbname="digital_twin", user="digital_twin", password="Pr0jec7@D!g!tTwiN", - host="192.168.1.82", - port="1111", + host={COLLECTOR_HOSTNAME}, + port={COLLECTOR_PORT}, ) return production_connection except Exception as e: @@ -30,15 +31,15 @@ def get_connection(): dbname="digital_twin", user="postgres", password="postgres", - host="192.168.1.85", - port="5432", + host={DATABASE_HOSTNAME}, + port={DATABASE_PORT}, ) connection_wo_db = psycopg2.connect( dbname="digital_twin", user="postgres", password="postgres", - host="192.168.1.86", - port="5432", + host={COLLECTOR_HOSTNAME}, + port={COLLECTOR_PORT}, ) return connection, connection_wo_db except Exception as e: