aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/common/postgres.py
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2023-11-09 13:57:26 +0100
committerDennis Eriksen <d@ennis.no>2023-11-09 13:57:26 +0100
commit4ad7f2e5111ca9e27dcbe5781c87f249bc7377ad (patch)
treed605620535229e741f7e2da473086fe185f78e5f /scripts/common/postgres.py
parentsmall fixes (diff)
downloadenergyscripts-4ad7f2e5111ca9e27dcbe5781c87f249bc7377ad.tar.gz
added new function to get env
which handles missing env better...
Diffstat (limited to 'scripts/common/postgres.py')
-rw-r--r--scripts/common/postgres.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/common/postgres.py b/scripts/common/postgres.py
index 5f6ea31..5692535 100644
--- a/scripts/common/postgres.py
+++ b/scripts/common/postgres.py
@@ -1,15 +1,16 @@
#!/usr/bin/env python3
""" common functions and stuff """
-import os
import sys
import psycopg
-pg_db = os.environ["el_pg_db"]
-pg_host = os.environ["el_pg_host"]
-pg_user = os.environ.get("el_pg_user", "")
-pg_pass = os.environ.get("el_pg_pass", "")
+from . import env
+
+pg_db = env("el_pg_db")
+pg_host = env("el_pg_host")
+pg_user = env("el_pg_user", "")
+pg_pass = env("el_pg_pass", "")
def dbi(sql, values, **kwargs):