From fdac9446af23584da7af5be1f48aa66db4ac56fc Mon Sep 17 00:00:00 2001 From: marcsello Date: Wed, 22 Apr 2020 01:20:24 +0200 Subject: [PATCH] Fixed redis not using config variable --- app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 86c047d..81d8cc6 100644 --- a/app.py +++ b/app.py @@ -26,7 +26,7 @@ def main(): logging.basicConfig(filename='', level=logging.DEBUG) # connect to redis - r = redis.Redis(host='localhost', port=6379, db=0) + r = redis.from_url(os.get('REDIS_URL', "redis://localhost:6379/0")) # set initial consumer addresses ip_list = os.environ['INITIAL_SERVERS'].split(',') @@ -91,7 +91,8 @@ def main(): continue try: - response = requests.post(f"http://{ip}/ip", json={'uuid': os.environ['LOCAL_UUID'], 'ip': current_ip}) + response = requests.post(f"http://{ip}/ip", + json={'uuid': os.environ['LOCAL_UUID'], 'ip': current_ip}) logging.debug(f"Pushed update to {key.decode('utf-8')} at {ip}. Response: {response.status_code}") except requests.exceptions.ConnectionError as e: logging.warning(f"Could not push update to {key.decode('utf-8')}: {str(e)}")