From 7b791df337a6b56cfb1fb1708ed7a0eb33af67eb Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 18:33:10 +0000 Subject: [PATCH] feat: add extra.py to wrap DATABASES with DynamicSchemaDict --- extra.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 extra.py diff --git a/extra.py b/extra.py new file mode 100644 index 0000000..b62563b --- /dev/null +++ b/extra.py @@ -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', +]