Skip to content

Commit 846a1a7

Browse files
authored
Support configuration of postgres port (#911)
Signed-off-by: Anja Strunk <[email protected]>
1 parent 2602be8 commit 846a1a7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compliance-monitor/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ services:
2626
- "127.0.0.1:5000:8080"
2727
environment:
2828
- SCM_DB_HOST=postgres
29+
- SCM_DB_PORT=5432
2930
- SCM_DB_PASSWORD_FILE=/run/secrets/db_password
3031
- SCM_BASE_URL=https://compliance.sovereignit.cloud/
3132
volumes:

compliance-monitor/monitor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
class Settings:
6363
def __init__(self):
6464
self.db_host = os.getenv("SCM_DB_HOST", "localhost")
65+
self.db_port = os.getenv("SCM_DB_PORT", 5432)
6566
self.db_user = os.getenv("SCM_DB_USER", "postgres")
6667
password_file_path = os.getenv("SCM_DB_PASSWORD_FILE", None)
6768
if password_file_path:
@@ -144,7 +145,8 @@ def default(self, obj):
144145

145146

146147
def mk_conn(settings=settings):
147-
return psycopg2.connect(host=settings.db_host, user=settings.db_user, password=settings.db_password)
148+
return psycopg2.connect(host=settings.db_host, user=settings.db_user,
149+
password=settings.db_password, port=settings.db_port)
148150

149151

150152
def get_conn(settings=settings):

0 commit comments

Comments
 (0)