ALLOWED_HOSTS = [
    '${node.metadata.get('netbox/domain')}'
]

DATABASE = {
    'NAME': 'netbox',
    'USER': 'netbox',
    'PASSWORD': '${repo.vault.password_for("netbox postgresql " + node.name)}',
    'HOST': 'localhost',
    'PORT': '',
}

REDIS = {
    'tasks': {
        'HOST': 'localhost',
        'PORT': 6379,
        'PASSWORD': '',
        'DATABASE': ${repo.libs.defaults.redis_databases['netbox'][0]},
        'DEFAULT_TIMEOUT': 300,
        'SSL': False,
    },
    'caching': {
        'HOST': 'localhost',
        'PORT': 6379,
        'PASSWORD': '',
        'DATABASE': ${repo.libs.defaults.redis_databases['netbox'][1]},
        'DEFAULT_TIMEOUT': 300,
        'SSL': False,
    }
}

SECRET_KEY = '${repo.vault.password_for('django secret netbox ' + node.name, length=50)}'

ADMINS = [
% for name, email in sorted(node.metadata.get('netbox/admins', {}).items()):
    ('${name}', '${email}'),
% endfor
]

AUTH_PASSWORD_VALIDATORS = []

BASE_PATH = ''

CORS_ORIGIN_ALLOW_ALL = False
CORS_ORIGIN_WHITELIST = [
% for hostname in sorted(node.metadata.get('netbox/cors_allowlist', set())):
    '${hostname}',
% endfor
]
CORS_ORIGIN_REGEX_WHITELIST = []

DEBUG = False

EMAIL = {
    'SERVER': 'localhost',
    'PORT': 25,
    'USERNAME': '',
    'PASSWORD': '',
    'TIMEOUT': 10, # seconds
    'FROM_EMAIL': '',
}

ENFORCE_GLOBAL_UNIQUE = True

EXEMPT_VIEW_PERMISSIONS = []

INTERNAL_IPS = ('127.0.0.1', '::1')

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'WARNING',
    },
}

LOGIN_PERSISTENCE = True
LOGIN_REQUIRED = False
LOGIN_TIMEOUT = 14 * 24*60*60

MEDIA_ROOT = '/opt/netbox/media'

METRICS_ENABLED = False

NAPALM_USERNAME = ''
NAPALM_PASSWORD = ''
NAPALM_TIMEOUT = 30
NAPALM_ARGS = {}

PLUGINS = []

PREFER_IPV4 = False

RACK_ELEVATION_DEFAULT_UNIT_HEIGHT = 22
RACK_ELEVATION_DEFAULT_UNIT_WIDTH = 220

# We use icinga for that.
RELEASE_CHECK_URL = None

REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'

RQ_DEFAULT_TIMEOUT = 300

SCRIPTS_ROOT = '/opt/netbox/scripts'

SESSION_COOKIE_NAME = 'sessionid'
SESSION_FILE_PATH = None

TIME_ZONE = 'UTC'

DATE_FORMAT = 'N j, Y'
SHORT_DATE_FORMAT = 'Y-m-d'
TIME_FORMAT = 'g:i a'
SHORT_TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'N j, Y g:i a'
SHORT_DATETIME_FORMAT = 'Y-m-d H:i'