first commit
This commit is contained in:
30
.devcontainer/config/codespaces-configuration.py
Normal file
30
.devcontainer/config/codespaces-configuration.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# GitHub Codespaces NetBox Configuration
|
||||
# CSRF/hosts setup for Codespaces URLs
|
||||
|
||||
import os
|
||||
|
||||
codespace_name = os.environ.get("CODESPACE_NAME")
|
||||
port_domain = os.environ.get("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN", "app.github.dev")
|
||||
|
||||
if codespace_name:
|
||||
codespaces_url = f"https://{codespace_name}-8000.{port_domain}"
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
codespaces_url,
|
||||
"http://localhost:8000",
|
||||
"http://127.0.0.1:8000",
|
||||
]
|
||||
ALLOWED_HOSTS = [
|
||||
f"{codespace_name}-8000.{port_domain}",
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"*",
|
||||
]
|
||||
print(f"🔗 Codespaces detected: {codespace_name}")
|
||||
print(f"🔒 CSRF Trusted Origins: {CSRF_TRUSTED_ORIGINS}")
|
||||
print(f"🌐 Allowed Hosts: {ALLOWED_HOSTS}")
|
||||
else:
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
"http://localhost:8000",
|
||||
"http://127.0.0.1:8000",
|
||||
]
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
49
.devcontainer/config/extra-configuration.py.example
Normal file
49
.devcontainer/config/extra-configuration.py.example
Normal file
@@ -0,0 +1,49 @@
|
||||
# Example: Extra NetBox Configuration
|
||||
# Copy to 'extra-configuration.py' and customize
|
||||
|
||||
import os
|
||||
|
||||
# Example: Custom logging configuration
|
||||
# LOGGING = {
|
||||
# 'version': 1,
|
||||
# 'disable_existing_loggers': False,
|
||||
# 'handlers': {
|
||||
# 'file': {
|
||||
# 'level': 'INFO',
|
||||
# 'class': 'logging.FileHandler',
|
||||
# 'filename': '/opt/netbox/logs/netbox.log',
|
||||
# },
|
||||
# },
|
||||
# 'loggers': {
|
||||
# 'netbox_librenms_plugin': {
|
||||
# 'handlers': ['file'],
|
||||
# 'level': 'DEBUG',
|
||||
# 'propagate': True,
|
||||
# },
|
||||
# },
|
||||
# }
|
||||
|
||||
# Example: Time zone
|
||||
# TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC')
|
||||
|
||||
# Example: Auth backends
|
||||
# AUTHENTICATION_BACKENDS = [
|
||||
# 'django.contrib.auth.backends.RemoteUserBackend',
|
||||
# 'django.contrib.auth.backends.ModelBackend',
|
||||
# ]
|
||||
|
||||
# Example: Paths
|
||||
# MEDIA_ROOT = '/opt/netbox/netbox/media'
|
||||
# STATIC_ROOT = '/opt/netbox/netbox/static'
|
||||
|
||||
# Dev banners
|
||||
BANNER_TOP = "Development Environment"
|
||||
BANNER_BOTTOM = "NetBox LibreNMS Plugin Dev Container"
|
||||
BANNER_LOGIN = "NetBox LibreNMS Plugin Development access only"
|
||||
|
||||
# Plugin-specific configuration
|
||||
# PLUGINS_CONFIG = {
|
||||
# 'netbox_librenms_plugin': {
|
||||
# 'debug_logging': True,
|
||||
# },
|
||||
# }
|
||||
0
.devcontainer/config/extra-plugins.py.example
Normal file
0
.devcontainer/config/extra-plugins.py.example
Normal file
46
.devcontainer/config/plugin-config.py.example
Normal file
46
.devcontainer/config/plugin-config.py.example
Normal file
@@ -0,0 +1,46 @@
|
||||
"""
|
||||
Default plugin configuration for the NetBox LibreNMS Plugin in the dev container.
|
||||
|
||||
- This file is an example of Plugin configuration
|
||||
- Copy this file to .devcontainer/plugin-config.py
|
||||
- Edit values as needed.
|
||||
|
||||
- Add config for all other plugins here if any.
|
||||
"""
|
||||
|
||||
# Ensure our plugin is enabled in dev (the loader sets this as a default too)
|
||||
PLUGINS = [
|
||||
"netbox_librenms_plugin",
|
||||
]
|
||||
|
||||
# Sample configuration with example servers
|
||||
PLUGINS_CONFIG = {
|
||||
"netbox_librenms_plugin": {
|
||||
"servers": {
|
||||
"production": {
|
||||
"display_name": "Production LibreNMS",
|
||||
"librenms_url": "https://librenms-prod.example.com",
|
||||
"api_token": "your-prod-token",
|
||||
"cache_timeout": 300,
|
||||
"verify_ssl": True,
|
||||
"interface_name_field": "ifDescr",
|
||||
},
|
||||
"testing": {
|
||||
"display_name": "Test LibreNMS",
|
||||
"librenms_url": "https://librenms-test.example.com",
|
||||
"api_token": "your_test_token",
|
||||
"cache_timeout": 300,
|
||||
"verify_ssl": False,
|
||||
"interface_name_field": "ifName",
|
||||
},
|
||||
"development": {
|
||||
"display_name": "Dev LibreNMS",
|
||||
"librenms_url": "https://librenms-dev.example.com",
|
||||
"api_token": "your_dev_token",
|
||||
"cache_timeout": 180,
|
||||
"verify_ssl": False,
|
||||
"interface_name_field": "ifDescr",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user