From 43e497db3c14707bc53db0e284693a1dbc33de26 Mon Sep 17 00:00:00 2001 From: Ken Aerts Date: Sat, 31 Aug 2024 11:46:54 +0200 Subject: [PATCH] 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