All checks were successful
Build and Push Docker Images / build (push) Successful in 6s
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
# =============================================================================
|
|
# NetBox Local Settings for netbox-branching plugin
|
|
# =============================================================================
|
|
# This file configures DynamicSchemaDict required by netbox-branching.
|
|
# It wraps the DATABASE from configuration.py into DATABASES.
|
|
# Placed in /etc/netbox/config/
|
|
# =============================================================================
|
|
|
|
from netbox_branching.utilities import DynamicSchemaDict
|
|
|
|
# Import DATABASE from the already-loaded configuration
|
|
# At this point, DATABASE is available in the global namespace from configuration.py
|
|
# We need to wrap it with DynamicSchemaDict and delete the original DATABASE
|
|
|
|
# Wrap DATABASES with DynamicSchemaDict for dynamic schema support
|
|
# This is required for netbox-branching plugin to function correctly
|
|
DATABASES = DynamicSchemaDict({
|
|
'default': DATABASE,
|
|
})
|
|
|
|
# Delete DATABASE to avoid "DATABASE and DATABASES may not be set together" error
|
|
del DATABASE
|
|
|
|
# Employ the custom database router for branch-aware queries
|
|
DATABASE_ROUTERS = [
|
|
'netbox_branching.database.BranchAwareRouter',
|
|
]
|