|
6 | 6 | # Based on https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/configuration.example.py
|
7 | 7 |
|
8 | 8 | # Read secret from file
|
9 |
| -def read_secret(secret_name, default=''): |
| 9 | +def read_secret(secret_name, default=None): |
10 | 10 | try:
|
11 | 11 | f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8')
|
12 | 12 | except EnvironmentError:
|
@@ -54,15 +54,15 @@ def read_secret(secret_name, default=''):
|
54 | 54 | 'tasks': {
|
55 | 55 | 'HOST': os.environ.get('REDIS_HOST', 'localhost'),
|
56 | 56 | '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', ''), |
58 | 58 | 'DATABASE': int(os.environ.get('REDIS_DATABASE', 0)),
|
59 | 59 | 'DEFAULT_TIMEOUT': int(os.environ.get('REDIS_TIMEOUT', 300)),
|
60 | 60 | 'SSL': os.environ.get('REDIS_SSL', 'False').lower() == 'true',
|
61 | 61 | },
|
62 | 62 | 'webhooks': { # legacy setting, can be removed after Netbox seizes support for it
|
63 | 63 | 'HOST': os.environ.get('REDIS_HOST', 'localhost'),
|
64 | 64 | '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', ''), |
66 | 66 | 'DATABASE': int(os.environ.get('REDIS_DATABASE', 0)),
|
67 | 67 | 'DEFAULT_TIMEOUT': int(os.environ.get('REDIS_TIMEOUT', 300)),
|
68 | 68 | 'SSL': os.environ.get('REDIS_SSL', 'False').lower() == 'true',
|
|
0 commit comments