fix(env): ensure the .env is loaded

This commit is contained in:
2025-10-26 14:55:43 +03:00
parent ce48859079
commit 2b7fecb248
5 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import psycopg2
import os
def PSQLConnect():
conn = psycopg2.connect(os.getenv('POSTDRESS_CONNECTION'))
conn = psycopg2.connect(os.getenv('POSTGRES_URL'))
return conn
def PSQLCursor(conn):
+6 -6
View File
@@ -2,14 +2,14 @@ import os
from dotenv import load_dotenv
from .createLogger import createLogger
DOTENV_PATH = '.env'
log = createLogger("ENV")
def initializeENV():
dotenv_path = '../.env'
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
def initializeENV() -> bool:
if os.path.exists(DOTENV_PATH):
load_dotenv(DOTENV_PATH)
log.info('.env is loaded')
return 1
return True
else:
log.error('.env isn`t loaded')
return 0
return False