mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* merge branch develop * bugfix, signals for virtualization's class wasn't correctly defined * updated webhooks for 2.4 and cleanup * updated docs to cover changes to supervisor config * review changes and further cleanup * updated redis connection settings * cleanup settings
This commit is contained in:
committed by
Jeremy Stretch
parent
4fd52d46bf
commit
836478c166
@ -64,6 +64,8 @@ NAPALM_ARGS = getattr(configuration, 'NAPALM_ARGS', {})
|
||||
PAGINATE_COUNT = getattr(configuration, 'PAGINATE_COUNT', 50)
|
||||
PREFER_IPV4 = getattr(configuration, 'PREFER_IPV4', False)
|
||||
REPORTS_ROOT = getattr(configuration, 'REPORTS_ROOT', os.path.join(BASE_DIR, 'reports')).rstrip('/')
|
||||
WEBHOOK_BACKEND_ENABLED = getattr(configuration, 'WEBHOOK_BACKEND_ENABLED', False)
|
||||
REDIS = getattr(configuration, 'REDIS', {})
|
||||
SHORT_DATE_FORMAT = getattr(configuration, 'SHORT_DATE_FORMAT', 'Y-m-d')
|
||||
SHORT_DATETIME_FORMAT = getattr(configuration, 'SHORT_DATETIME_FORMAT', 'Y-m-d H:i')
|
||||
SHORT_TIME_FORMAT = getattr(configuration, 'SHORT_TIME_FORMAT', 'H:i:s')
|
||||
@ -109,6 +111,13 @@ DATABASES = {
|
||||
'default': configuration.DATABASE,
|
||||
}
|
||||
|
||||
# Redis
|
||||
REDIS_HOST = REDIS.get('REDIS_HOST', 'localhost')
|
||||
REDIS_PORT = REDIS.get('REDIS_PORT', 6379)
|
||||
REDIS_DEFAULT_TIMEOUT = REDIS.get('REDIS_DEFAULT_TIMEOUT', 300)
|
||||
REDIS_PASSWORD = REDIS.get('REDIS_PASSWORD', '')
|
||||
REDIS_DB = REDIS.get('REDIS_DB', 0)
|
||||
|
||||
# Email
|
||||
EMAIL_HOST = EMAIL.get('SERVER')
|
||||
EMAIL_PORT = EMAIL.get('PORT', 25)
|
||||
@ -119,7 +128,7 @@ SERVER_EMAIL = EMAIL.get('FROM_EMAIL')
|
||||
EMAIL_SUBJECT_PREFIX = '[NetBox] '
|
||||
|
||||
# Installed applications
|
||||
INSTALLED_APPS = (
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
@ -145,7 +154,11 @@ INSTALLED_APPS = (
|
||||
'utilities',
|
||||
'virtualization',
|
||||
'drf_yasg',
|
||||
)
|
||||
]
|
||||
|
||||
# only load django-rq if the webhook backend is enabled
|
||||
if WEBHOOK_BACKEND_ENABLED:
|
||||
INSTALLED_APPS.append('django_rq')
|
||||
|
||||
# Middleware
|
||||
MIDDLEWARE = (
|
||||
@ -246,6 +259,17 @@ REST_FRAMEWORK = {
|
||||
'VIEW_NAME_FUNCTION': 'netbox.api.get_view_name',
|
||||
}
|
||||
|
||||
# Django RQ (Webhook backend)
|
||||
RQ_QUEUES = {
|
||||
'default': {
|
||||
'HOST': REDIS_HOST,
|
||||
'PORT': REDIS_PORT,
|
||||
'DB': REDIS_DB,
|
||||
'PASSWORD': REDIS_PASSWORD,
|
||||
'DEFAULT_TIMEOUT': REDIS_DEFAULT_TIMEOUT,
|
||||
}
|
||||
}
|
||||
|
||||
# drf_yasg settings for Swagger
|
||||
SWAGGER_SETTINGS = {
|
||||
'DEFAULT_FIELD_INSPECTORS': [
|
||||
@ -278,6 +302,14 @@ INTERNAL_IPS = (
|
||||
'::1',
|
||||
)
|
||||
|
||||
# Django CACHE - local memory cache
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': 'webhooks',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try:
|
||||
HOSTNAME = socket.gethostname()
|
||||
|
Reference in New Issue
Block a user