Googolplexic commited on
Commit
feab7d6
·
1 Parent(s): 0efe045

Forgot to actually update

Browse files
Files changed (2) hide show
  1. api_client.py +0 -1
  2. api_monitor.py +11 -4
api_client.py CHANGED
@@ -1,6 +1,5 @@
1
  import requests
2
  import json
3
- import psycopg2
4
 
5
 
6
  def parse_key_value_string(key_value_string):
 
1
  import requests
2
  import json
 
3
 
4
 
5
  def parse_key_value_string(key_value_string):
api_monitor.py CHANGED
@@ -25,11 +25,18 @@ def connect_to_db():
25
  raise ValueError(
26
  "Database password not found in environment variables. Please set DB_PASSWORD."
27
  )
 
 
 
 
 
 
 
28
  return psycopg2.connect(
29
- host="aws-0-us-west-1.pooler.supabase.com",
30
- port=6543,
31
- database="postgres",
32
- user="postgres.rivuplskngyevyzlshuh",
33
  password=db_password,
34
  cursor_factory=psycopg2.extras.DictCursor,
35
  )
 
25
  raise ValueError(
26
  "Database password not found in environment variables. Please set DB_PASSWORD."
27
  )
28
+
29
+ # Get database connection details from environment variables with defaults
30
+ db_host = os.getenv("DB_HOST")
31
+ db_port = int(os.getenv("DB_PORT"))
32
+ db_name = os.getenv("DB_NAME")
33
+ db_user = os.getenv("DB_USER")
34
+
35
  return psycopg2.connect(
36
+ host=db_host,
37
+ port=db_port,
38
+ database=db_name,
39
+ user=db_user,
40
  password=db_password,
41
  cursor_factory=psycopg2.extras.DictCursor,
42
  )