From 43e497db3c14707bc53db0e284693a1dbc33de26 Mon Sep 17 00:00:00 2001 From: Ken Aerts Date: Sat, 31 Aug 2024 11:46:54 +0200 Subject: [PATCH 1/2] initial proposal issue #1105 also included variables in netbox.env --- configuration/configuration.py | 8 ++++++-- env/netbox.env | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index 2145a2511..4d4fddf52 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -71,8 +71,12 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn: # PostgreSQL password 'HOST': environ.get('DB_HOST', 'localhost'), # Database server 'PORT': environ.get('DB_PORT', ''), # Database port (leave blank for default) - 'OPTIONS': {'sslmode': environ.get('DB_SSLMODE', 'prefer')}, - # Database connection SSLMODE + 'OPTIONS': { + 'sslmode': environ.get('DB_SSLMODE', 'prefer'), # Database connection SSLMODE + 'sslcert': environ.get('DB_CLIENT_SSL_CERT', None), + 'sslkey': environ.get('DB_CLIENT_SSL_KEY', None), + 'sslrootcert': environ.get('DB_CLIENT_SSL_CA', None) + }, 'CONN_MAX_AGE': _environ_get_and_map('DB_CONN_MAX_AGE', '300', _AS_INT), # Max database connection age 'DISABLE_SERVER_SIDE_CURSORS': _environ_get_and_map('DB_DISABLE_SERVER_SIDE_CURSORS', 'False', _AS_BOOL), diff --git a/env/netbox.env b/env/netbox.env index ca2254917..adf9aa874 100644 --- a/env/netbox.env +++ b/env/netbox.env @@ -3,6 +3,9 @@ DB_HOST=postgres DB_NAME=netbox DB_PASSWORD=J5brHrAXFLQSif0K DB_USER=netbox +DB_CLIENT_SSL_CERT= +DB_CLIENT_SSL_KEY= +DB_CLIENT_SSL_CA= EMAIL_FROM=netbox@bar.com EMAIL_PASSWORD= EMAIL_PORT=25 From 2645f86771174058f482dc93d36574d985fe2506 Mon Sep 17 00:00:00 2001 From: crimmy68 <77836204+crimmy68@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:25:32 +0200 Subject: [PATCH 2/2] Update netbox.env Re-ordered variables as indicated by the syntax check. --- env/netbox.env | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/env/netbox.env b/env/netbox.env index adf9aa874..ba72f1103 100644 --- a/env/netbox.env +++ b/env/netbox.env @@ -1,11 +1,11 @@ CORS_ORIGIN_ALLOW_ALL=True +DB_CLIENT_SSL_CA= +DB_CLIENT_SSL_CERT= +DB_CLIENT_SSL_KEY= DB_HOST=postgres DB_NAME=netbox DB_PASSWORD=J5brHrAXFLQSif0K DB_USER=netbox -DB_CLIENT_SSL_CERT= -DB_CLIENT_SSL_KEY= -DB_CLIENT_SSL_CA= EMAIL_FROM=netbox@bar.com EMAIL_PASSWORD= EMAIL_PORT=25