Skip to content

Commit 9287995

Browse files
committed
Update to latest configuration
1 parent 85fbb0a commit 9287995

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

configuration/configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Based on https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/configuration.example.py
77

88
# Read secret from file
9-
def read_secret(secret_name, default=''):
9+
def read_secret(secret_name, default=None):
1010
try:
1111
f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8')
1212
except EnvironmentError:
@@ -54,15 +54,15 @@ def read_secret(secret_name, default=''):
5454
'tasks': {
5555
'HOST': os.environ.get('REDIS_HOST', 'localhost'),
5656
'PORT': int(os.environ.get('REDIS_PORT', 6379)),
57-
'PASSWORD': os.environ.get('REDIS_PASSWORD', read_secret('redis_password')),
57+
'PASSWORD': read_secret('redis_password', os.environ.get('REDIS_PASSWORD', ''),
5858
'DATABASE': int(os.environ.get('REDIS_DATABASE', 0)),
5959
'DEFAULT_TIMEOUT': int(os.environ.get('REDIS_TIMEOUT', 300)),
6060
'SSL': os.environ.get('REDIS_SSL', 'False').lower() == 'true',
6161
},
6262
'webhooks': { # legacy setting, can be removed after Netbox seizes support for it
6363
'HOST': os.environ.get('REDIS_HOST', 'localhost'),
6464
'PORT': int(os.environ.get('REDIS_PORT', 6379)),
65-
'PASSWORD': read_secret('redis_password', os.environ.get('REDIS_PASSWORD', '')),
65+
'PASSWORD': read_secret('redis_password', os.environ.get('REDIS_PASSWORD', ''),
6666
'DATABASE': int(os.environ.get('REDIS_DATABASE', 0)),
6767
'DEFAULT_TIMEOUT': int(os.environ.get('REDIS_TIMEOUT', 300)),
6868
'SSL': os.environ.get('REDIS_SSL', 'False').lower() == 'true',

0 commit comments

Comments
 (0)