From 9287995df4ad5f126514c274895935c9c785d267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Tue, 20 Oct 2020 19:22:52 +0200 Subject: [PATCH] Update to latest configuration --- configuration/configuration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index ae777e4..f7c8ed5 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -6,7 +6,7 @@ import socket # Based on https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/configuration.example.py # Read secret from file -def read_secret(secret_name, default=''): +def read_secret(secret_name, default=None): try: f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8') except EnvironmentError: @@ -54,7 +54,7 @@ REDIS = { 'tasks': { 'HOST': os.environ.get('REDIS_HOST', 'localhost'), 'PORT': int(os.environ.get('REDIS_PORT', 6379)), - 'PASSWORD': os.environ.get('REDIS_PASSWORD', read_secret('redis_password')), + 'PASSWORD': read_secret('redis_password', os.environ.get('REDIS_PASSWORD', ''), 'DATABASE': int(os.environ.get('REDIS_DATABASE', 0)), 'DEFAULT_TIMEOUT': int(os.environ.get('REDIS_TIMEOUT', 300)), 'SSL': os.environ.get('REDIS_SSL', 'False').lower() == 'true', @@ -62,7 +62,7 @@ REDIS = { 'webhooks': { # legacy setting, can be removed after Netbox seizes support for it 'HOST': os.environ.get('REDIS_HOST', 'localhost'), 'PORT': int(os.environ.get('REDIS_PORT', 6379)), - 'PASSWORD': read_secret('redis_password', os.environ.get('REDIS_PASSWORD', '')), + 'PASSWORD': read_secret('redis_password', os.environ.get('REDIS_PASSWORD', ''), 'DATABASE': int(os.environ.get('REDIS_DATABASE', 0)), 'DEFAULT_TIMEOUT': int(os.environ.get('REDIS_TIMEOUT', 300)), 'SSL': os.environ.get('REDIS_SSL', 'False').lower() == 'true',