fix: build DATABASE from env vars instead of importing
All checks were successful
Build and Push Docker Images / build (push) Successful in 6s
All checks were successful
Build and Push Docker Images / build (push) Successful in 6s
This commit is contained in:
@@ -3,11 +3,22 @@
|
||||
# =============================================================================
|
||||
# This file configures DynamicSchemaDict required by netbox-branching.
|
||||
# It imports DATABASE from the NetBox Docker configuration and wraps it.
|
||||
# Placed in /etc/netbox/config/ alongside configuration.py
|
||||
# Placed in /etc/netbox/config/
|
||||
# =============================================================================
|
||||
|
||||
import os
|
||||
from netbox_branching.utilities import DynamicSchemaDict
|
||||
from .configuration import DATABASE
|
||||
|
||||
# Build DATABASE dict from environment variables (same as netbox-docker does)
|
||||
DATABASE = {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': os.environ.get('DB_NAME', 'netbox'),
|
||||
'USER': os.environ.get('DB_USER', ''),
|
||||
'PASSWORD': os.environ.get('DB_PASSWORD', ''),
|
||||
'HOST': os.environ.get('DB_HOST', 'localhost'),
|
||||
'PORT': os.environ.get('DB_PORT', ''),
|
||||
'CONN_MAX_AGE': int(os.environ.get('DB_CONN_MAX_AGE', 300)),
|
||||
}
|
||||
|
||||
# Wrap DATABASES with DynamicSchemaDict for dynamic schema support
|
||||
# This is required for netbox-branching plugin to function correctly
|
||||
|
||||
Reference in New Issue
Block a user