Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra environment variables for SSL encryption to the database #1296

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions env/netbox.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
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
Expand Down