From ec3fd8a7907f19d406c87d7e6ef954a39e8cd972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Tue, 20 Oct 2020 21:36:40 +0200 Subject: [PATCH] Revert accidential change to _read_secret order --- configuration/configuration.py | 12 ++++++------ configuration/ldap/ldap_config.py | 2 +- docker/configuration.docker.py | 1 - docker/ldap_config.docker.py | 1 - 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index 4d1a146..f111c19 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -41,7 +41,7 @@ ALLOWED_HOSTS = environ.get('ALLOWED_HOSTS', '*').split(' ') DATABASE = { 'NAME': environ.get('DB_NAME', 'netbox'), # Database name 'USER': environ.get('DB_USER', ''), # PostgreSQL username - 'PASSWORD': environ.get('DB_PASSWORD', _read_secret('db_password')), + 'PASSWORD': _read_secret('db_password', environ.get('DB_PASSWORD', '')), # PostgreSQL password 'HOST': environ.get('DB_HOST', 'localhost'), # Database server 'PORT': environ.get('DB_PORT', ''), # Database port (leave blank for default) @@ -58,14 +58,14 @@ REDIS = { 'tasks': { 'HOST': environ.get('REDIS_HOST', 'localhost'), 'PORT': int(environ.get('REDIS_PORT', 6379)), - 'PASSWORD': environ.get('REDIS_PASSWORD', _read_secret('redis_password')), + 'PASSWORD': _read_secret('redis_password', environ.get('REDIS_PASSWORD', '')), 'DATABASE': int(environ.get('REDIS_DATABASE', 0)), 'SSL': environ.get('REDIS_SSL', 'False').lower() == 'true', }, 'caching': { 'HOST': environ.get('REDIS_CACHE_HOST', environ.get('REDIS_HOST', 'localhost')), 'PORT': int(environ.get('REDIS_CACHE_PORT', environ.get('REDIS_PORT', 6379))), - 'PASSWORD': environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', _read_secret('redis_cache_password'))), + 'PASSWORD': _read_secret('redis_cache_password', environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', ''))), 'DATABASE': int(environ.get('REDIS_CACHE_DATABASE', 1)), 'SSL': environ.get('REDIS_CACHE_SSL', environ.get('REDIS_SSL', 'False')).lower() == 'true', }, @@ -75,7 +75,7 @@ REDIS = { # For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and # symbols. NetBox will not run without this defined. For more information, see # https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY -SECRET_KEY = environ.get('SECRET_KEY', _read_secret('secret_key')) +SECRET_KEY = _read_secret('secret_key', environ.get('SECRET_KEY')) ######################### @@ -130,7 +130,7 @@ EMAIL = { 'SERVER': environ.get('EMAIL_SERVER', 'localhost'), 'PORT': int(environ.get('EMAIL_PORT', 25)), 'USERNAME': environ.get('EMAIL_USERNAME', ''), - 'PASSWORD': environ.get('EMAIL_PASSWORD', _read_secret('email_password')), + 'PASSWORD': _read_secret('email_password', environ.get('EMAIL_PASSWORD', '')), 'USE_SSL': environ.get('EMAIL_USE_SSL', 'False').lower() == 'true', 'USE_TLS': environ.get('EMAIL_USE_TLS', 'False').lower() == 'true', 'SSL_CERTFILE': environ.get('EMAIL_SSL_CERTFILE', ''), @@ -176,7 +176,7 @@ METRICS_ENABLED = environ.get('METRICS_ENABLED', 'False').lower() == 'true' # Credentials that NetBox will uses to authenticate to devices when connecting via NAPALM. NAPALM_USERNAME = environ.get('NAPALM_USERNAME', '') -NAPALM_PASSWORD = environ.get('NAPALM_PASSWORD', _read_secret('napalm_password')) +NAPALM_PASSWORD = _read_secret('napalm_password', environ.get('NAPALM_PASSWORD', '')) # NAPALM timeout (in seconds). (Default: 30) NAPALM_TIMEOUT = int(environ.get('NAPALM_TIMEOUT', 30)) diff --git a/configuration/ldap/ldap_config.py b/configuration/ldap/ldap_config.py index b92a79a..d1e4444 100644 --- a/configuration/ldap/ldap_config.py +++ b/configuration/ldap/ldap_config.py @@ -32,7 +32,7 @@ AUTH_LDAP_CONNECTION_OPTIONS = { # Set the DN and password for the NetBox service account. AUTH_LDAP_BIND_DN = environ.get('AUTH_LDAP_BIND_DN', '') -AUTH_LDAP_BIND_PASSWORD = environ.get('AUTH_LDAP_BIND_PASSWORD', _read_secret('auth_ldap_bind_password')) +AUTH_LDAP_BIND_PASSWORD = _read_secret('auth_ldap_bind_password', environ.get('AUTH_LDAP_BIND_PASSWORD', '')) # Set a string template that describes any user’s distinguished name based on the username. AUTH_LDAP_USER_DN_TEMPLATE = environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None) diff --git a/docker/configuration.docker.py b/docker/configuration.docker.py index 68a12e4..1a3590d 100644 --- a/docker/configuration.docker.py +++ b/docker/configuration.docker.py @@ -54,7 +54,6 @@ with scandir(_CONFIG_DIR) as it: continue module_name = f"{_MODULE}.{f.name[:-len('.py')]}".replace(".", "_") - _import(module_name, f.path) if len(_loaded_configurations) == 0: diff --git a/docker/ldap_config.docker.py b/docker/ldap_config.docker.py index ca8329d..45ffe7c 100644 --- a/docker/ldap_config.docker.py +++ b/docker/ldap_config.docker.py @@ -54,7 +54,6 @@ with scandir(_CONFIG_DIR) as it: continue module_name = f"{_MODULE}.{f.name[:-len('.py')]}".replace(".", "_") - _import(module_name, f.path) if len(_loaded_configurations) == 0: