fix dynamic env database hostname and port

main
MrWaradana 3 days ago
parent e3963ff5f2
commit 44a154c38d

@ -1,4 +1,5 @@
import psycopg2 import psycopg2
from src.config import DATABASE_HOSTNAME, DATABASE_PORT, COLLECTOR_HOSTNAME, COLLECTOR_PORT
def get_production_connection(): def get_production_connection():
try: try:
@ -7,8 +8,8 @@ def get_production_connection():
dbname="digital_twin", dbname="digital_twin",
user="digital_twin", user="digital_twin",
password="Pr0jec7@D!g!tTwiN", password="Pr0jec7@D!g!tTwiN",
host="192.168.1.82", host={COLLECTOR_HOSTNAME},
port="1111", port={COLLECTOR_PORT},
) )
return production_connection return production_connection
except Exception as e: except Exception as e:
@ -30,15 +31,15 @@ def get_connection():
dbname="digital_twin", dbname="digital_twin",
user="postgres", user="postgres",
password="postgres", password="postgres",
host="192.168.1.85", host={DATABASE_HOSTNAME},
port="5432", port={DATABASE_PORT},
) )
connection_wo_db = psycopg2.connect( connection_wo_db = psycopg2.connect(
dbname="digital_twin", dbname="digital_twin",
user="postgres", user="postgres",
password="postgres", password="postgres",
host="192.168.1.86", host={COLLECTOR_HOSTNAME},
port="5432", port={COLLECTOR_PORT},
) )
return connection, connection_wo_db return connection, connection_wo_db
except Exception as e: except Exception as e:

Loading…
Cancel
Save