refactor: simplify plugins.py (DB config moved to configuration.py)
This commit is contained in:
30
plugins.py
30
plugins.py
@@ -1,15 +1,11 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
# NetBox Plugins Configuration
|
# NetBox Plugins Configuration
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# This file activates and configures NetBox plugins.
|
|
||||||
# Mount this file to /etc/netbox/config/plugins.py
|
# Mount this file to /etc/netbox/config/plugins.py
|
||||||
#
|
#
|
||||||
# IMPORTANT: netbox_branching MUST be the last plugin in the list
|
# IMPORTANT: netbox_branching MUST be the last plugin in the list
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Plugin list - netbox_branching must be LAST
|
|
||||||
PLUGINS = [
|
PLUGINS = [
|
||||||
'netbox_bgp',
|
'netbox_bgp',
|
||||||
'netbox_secrets',
|
'netbox_secrets',
|
||||||
@@ -21,35 +17,9 @@ PLUGINS = [
|
|||||||
'netbox_branching', # MUST be last
|
'netbox_branching', # MUST be last
|
||||||
]
|
]
|
||||||
|
|
||||||
# Plugin configuration
|
|
||||||
PLUGINS_CONFIG = {
|
PLUGINS_CONFIG = {
|
||||||
'netbox_branching': {},
|
'netbox_branching': {},
|
||||||
'netbox_bgp': {},
|
'netbox_bgp': {},
|
||||||
'netbox_secrets': {},
|
'netbox_secrets': {},
|
||||||
'netbox_topology_views': {},
|
'netbox_topology_views': {},
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
|
||||||
# NetBox Branching - Database Configuration
|
|
||||||
# =============================================================================
|
|
||||||
# Required for netbox-branching plugin to work properly.
|
|
||||||
# See: https://netboxlabs.com/docs/extensions/branching/netbox-docker/
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
from netbox_branching.utilities import DynamicSchemaDict
|
|
||||||
|
|
||||||
DATABASES = DynamicSchemaDict({
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
|
||||||
'NAME': os.environ.get('DB_NAME', 'netbox'),
|
|
||||||
'USER': os.environ.get('DB_USER', 'netbox'),
|
|
||||||
'PASSWORD': os.environ.get('DB_PASSWORD', ''),
|
|
||||||
'HOST': os.environ.get('DB_HOST', 'postgres'),
|
|
||||||
'PORT': os.environ.get('DB_PORT', ''),
|
|
||||||
'CONN_MAX_AGE': int(os.environ.get('DB_CONN_MAX_AGE', '300')),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
DATABASE_ROUTERS = [
|
|
||||||
'netbox_branching.database.BranchAwareRouter',
|
|
||||||
]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user