|
@@ -1,6 +1,7 @@
|
|
|
import logging
|
|
import logging
|
|
|
import os
|
|
import os
|
|
|
import platform
|
|
import platform
|
|
|
|
|
+import re
|
|
|
import socket
|
|
import socket
|
|
|
import warnings
|
|
import warnings
|
|
|
|
|
|
|
@@ -78,6 +79,8 @@ DEVELOPER = getattr(configuration, 'DEVELOPER', False)
|
|
|
EMAIL = getattr(configuration, 'EMAIL', {})
|
|
EMAIL = getattr(configuration, 'EMAIL', {})
|
|
|
ENFORCE_GLOBAL_UNIQUE = getattr(configuration, 'ENFORCE_GLOBAL_UNIQUE', False)
|
|
ENFORCE_GLOBAL_UNIQUE = getattr(configuration, 'ENFORCE_GLOBAL_UNIQUE', False)
|
|
|
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
|
|
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
|
|
|
|
|
+GITHUB_REPOSITORY = getattr(configuration, 'GITHUB_REPOSITORY', 'netbox-community/netbox')
|
|
|
|
|
+GITHUB_VERSION_TIMEOUT = getattr(configuration, 'GITHUB_VERSION_TIMEOUT', 8 * 3600)
|
|
|
LOGGING = getattr(configuration, 'LOGGING', {})
|
|
LOGGING = getattr(configuration, 'LOGGING', {})
|
|
|
LOGIN_REQUIRED = getattr(configuration, 'LOGIN_REQUIRED', False)
|
|
LOGIN_REQUIRED = getattr(configuration, 'LOGIN_REQUIRED', False)
|
|
|
LOGIN_TIMEOUT = getattr(configuration, 'LOGIN_TIMEOUT', None)
|
|
LOGIN_TIMEOUT = getattr(configuration, 'LOGIN_TIMEOUT', None)
|
|
@@ -292,6 +295,7 @@ TEMPLATES = [
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
'utilities.context_processors.settings',
|
|
'utilities.context_processors.settings',
|
|
|
|
|
+ 'utilities.context_processors.latest_version',
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -302,6 +306,12 @@ AUTHENTICATION_BACKENDS = [
|
|
|
'utilities.auth_backends.ViewExemptModelBackend',
|
|
'utilities.auth_backends.ViewExemptModelBackend',
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+# GitHub repository for version check
|
|
|
|
|
+if GITHUB_REPOSITORY and not re.fullmatch(r'[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+', GITHUB_REPOSITORY):
|
|
|
|
|
+ raise ImproperlyConfigured(
|
|
|
|
|
+ "GITHUB_REPOSITORY must contain the name of a GitHub repository in the form '<owner>/<repository>'"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
# Internationalization
|
|
# Internationalization
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
USE_I18N = True
|
|
USE_I18N = True
|