From 4ad7f2e5111ca9e27dcbe5781c87f249bc7377ad Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 9 Nov 2023 13:57:26 +0100 Subject: added new function to get env which handles missing env better... --- scripts/common/postgres.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts/common/postgres.py') 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): -- cgit v1.2.3