From dcf771db9bc2750032e061caf9862b30c090831c Mon Sep 17 00:00:00 2001 From: Walter Date: Fri, 21 Feb 2025 00:19:09 +0100 Subject: [PATCH] Fixed wait for db --- app/wait_for_db.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/wait_for_db.py b/app/wait_for_db.py index d955c98..6ece4e2 100644 --- a/app/wait_for_db.py +++ b/app/wait_for_db.py @@ -2,8 +2,9 @@ import socket import time import os -port = int(os.environ["SQL_PORT"]) # 5432 -db_name = os.environ["SQL_DATABASE"] +port = int(os.environ.get("SQL_PORT")) # 5432 +db_name = os.environ.get("SQL_HOST") +print(f"database at {db_name}:{port}") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: @@ -11,5 +12,5 @@ while True: s.connect((db_name, port)) s.close() break - except socket.error as ex: + except socket.error: time.sleep(0.1) \ No newline at end of file