Bladeren bron

update credentials

Daniel Sheffield 1 week geleden
bovenliggende
commit
e76a10e29f
1 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 3 3
      grocery_transactions.py

+ 3 - 3
grocery_transactions.py

@@ -14,9 +14,10 @@ from app.data.QueryManager import QueryManager, display_mapper
 from app.palette import iter_palettes, solarized
 
 try:
-    from db_credentials import HOST, PASSWORD
+    from db_credentials import USER, HOST, PASSWORD
     host = f'host={HOST}'
     password = f'password={PASSWORD}'
+    user = f'user={USER}'
 except:
     host = ''
     password = ''
@@ -25,8 +26,7 @@ try:
     import os
 
     import psycopg
-    user = os.getenv('USER')
-    conn: Cursor = psycopg.connect(f"{host} dbname=grocery user={user} {password}")
+    conn: Cursor = psycopg.connect(f"{host} dbname=grocery {user} {password}")
     cur = conn.cursor()
 except:
     print('Failed to set up db connection. Entering Mock mode')