Skip to content

Commit ec3fd8a

Browse files
committed
Revert accidential change to _read_secret order
1 parent 75554ef commit ec3fd8a

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

configuration/configuration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _read_secret(secret_name, default = None):
4141
DATABASE = {
4242
'NAME': environ.get('DB_NAME', 'netbox'), # Database name
4343
'USER': environ.get('DB_USER', ''), # PostgreSQL username
44-
'PASSWORD': environ.get('DB_PASSWORD', _read_secret('db_password')),
44+
'PASSWORD': _read_secret('db_password', environ.get('DB_PASSWORD', '')),
4545
# PostgreSQL password
4646
'HOST': environ.get('DB_HOST', 'localhost'), # Database server
4747
'PORT': environ.get('DB_PORT', ''), # Database port (leave blank for default)
@@ -58,14 +58,14 @@ def _read_secret(secret_name, default = None):
5858
'tasks': {
5959
'HOST': environ.get('REDIS_HOST', 'localhost'),
6060
'PORT': int(environ.get('REDIS_PORT', 6379)),
61-
'PASSWORD': environ.get('REDIS_PASSWORD', _read_secret('redis_password')),
61+
'PASSWORD': _read_secret('redis_password', environ.get('REDIS_PASSWORD', '')),
6262
'DATABASE': int(environ.get('REDIS_DATABASE', 0)),
6363
'SSL': environ.get('REDIS_SSL', 'False').lower() == 'true',
6464
},
6565
'caching': {
6666
'HOST': environ.get('REDIS_CACHE_HOST', environ.get('REDIS_HOST', 'localhost')),
6767
'PORT': int(environ.get('REDIS_CACHE_PORT', environ.get('REDIS_PORT', 6379))),
68-
'PASSWORD': environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', _read_secret('redis_cache_password'))),
68+
'PASSWORD': _read_secret('redis_cache_password', environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', ''))),
6969
'DATABASE': int(environ.get('REDIS_CACHE_DATABASE', 1)),
7070
'SSL': environ.get('REDIS_CACHE_SSL', environ.get('REDIS_SSL', 'False')).lower() == 'true',
7171
},
@@ -75,7 +75,7 @@ def _read_secret(secret_name, default = None):
7575
# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and
7676
# symbols. NetBox will not run without this defined. For more information, see
7777
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY
78-
SECRET_KEY = environ.get('SECRET_KEY', _read_secret('secret_key'))
78+
SECRET_KEY = _read_secret('secret_key', environ.get('SECRET_KEY'))
7979

8080

8181
#########################
@@ -130,7 +130,7 @@ def _read_secret(secret_name, default = None):
130130
'SERVER': environ.get('EMAIL_SERVER', 'localhost'),
131131
'PORT': int(environ.get('EMAIL_PORT', 25)),
132132
'USERNAME': environ.get('EMAIL_USERNAME', ''),
133-
'PASSWORD': environ.get('EMAIL_PASSWORD', _read_secret('email_password')),
133+
'PASSWORD': _read_secret('email_password', environ.get('EMAIL_PASSWORD', '')),
134134
'USE_SSL': environ.get('EMAIL_USE_SSL', 'False').lower() == 'true',
135135
'USE_TLS': environ.get('EMAIL_USE_TLS', 'False').lower() == 'true',
136136
'SSL_CERTFILE': environ.get('EMAIL_SSL_CERTFILE', ''),
@@ -176,7 +176,7 @@ def _read_secret(secret_name, default = None):
176176

177177
# Credentials that NetBox will uses to authenticate to devices when connecting via NAPALM.
178178
NAPALM_USERNAME = environ.get('NAPALM_USERNAME', '')
179-
NAPALM_PASSWORD = environ.get('NAPALM_PASSWORD', _read_secret('napalm_password'))
179+
NAPALM_PASSWORD = _read_secret('napalm_password', environ.get('NAPALM_PASSWORD', ''))
180180

181181
# NAPALM timeout (in seconds). (Default: 30)
182182
NAPALM_TIMEOUT = int(environ.get('NAPALM_TIMEOUT', 30))

configuration/ldap/ldap_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _import_group_type(group_type_name):
3232

3333
# Set the DN and password for the NetBox service account.
3434
AUTH_LDAP_BIND_DN = environ.get('AUTH_LDAP_BIND_DN', '')
35-
AUTH_LDAP_BIND_PASSWORD = environ.get('AUTH_LDAP_BIND_PASSWORD', _read_secret('auth_ldap_bind_password'))
35+
AUTH_LDAP_BIND_PASSWORD = _read_secret('auth_ldap_bind_password', environ.get('AUTH_LDAP_BIND_PASSWORD', ''))
3636

3737
# Set a string template that describes any user’s distinguished name based on the username.
3838
AUTH_LDAP_USER_DN_TEMPLATE = environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None)

docker/configuration.docker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def _import(module_name, path):
5454
continue
5555

5656
module_name = f"{_MODULE}.{f.name[:-len('.py')]}".replace(".", "_")
57-
5857
_import(module_name, f.path)
5958

6059
if len(_loaded_configurations) == 0:

docker/ldap_config.docker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def _import(module_name, path):
5454
continue
5555

5656
module_name = f"{_MODULE}.{f.name[:-len('.py')]}".replace(".", "_")
57-
5857
_import(module_name, f.path)
5958

6059
if len(_loaded_configurations) == 0:

0 commit comments

Comments
 (0)