feat: add extra.py to wrap DATABASES with DynamicSchemaDict
This commit is contained in:
20
extra.py
Normal file
20
extra.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# NetBox Extra Configuration for netbox-branching
|
||||||
|
# =============================================================================
|
||||||
|
# This file is loaded AFTER configuration.py and wraps DATABASES with
|
||||||
|
# DynamicSchemaDict as required by netbox-branching plugin.
|
||||||
|
# Mount this file to /etc/netbox/config/extra.py
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
from netbox_branching.utilities import DynamicSchemaDict
|
||||||
|
|
||||||
|
# Wrap the existing DATABASES dict with DynamicSchemaDict
|
||||||
|
# DATABASES is already defined in configuration.py from the base image
|
||||||
|
DATABASES = DynamicSchemaDict({
|
||||||
|
'default': DATABASES['default'],
|
||||||
|
})
|
||||||
|
|
||||||
|
# Database router for branch-aware queries
|
||||||
|
DATABASE_ROUTERS = [
|
||||||
|
'netbox_branching.database.BranchAwareRouter',
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user