|
| 1 | +import os |
| 2 | + |
| 3 | +# For reference see http://netbox.readthedocs.io/en/latest/configuration/mandatory-settings/ |
| 4 | +# Based on https://github.com/digitalocean/netbox/blob/develop/netbox/netbox/configuration.example.py |
| 5 | + |
| 6 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 7 | + |
| 8 | +######################### |
| 9 | +# # |
| 10 | +# Required settings # |
| 11 | +# # |
| 12 | +######################### |
| 13 | + |
| 14 | +# This is a list of valid fully-qualified domain names (FQDNs) for the NetBox server. NetBox will not permit write |
| 15 | +# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name. |
| 16 | +# |
| 17 | +# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local'] |
| 18 | +ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(" ") |
| 19 | + |
| 20 | +# PostgreSQL database configuration. |
| 21 | +DATABASE = { |
| 22 | + "NAME": os.environ.get("DB_NAME", "netbox"), # Database name |
| 23 | + "USER": os.environ.get("DB_USER", ""), # PostgreSQL username |
| 24 | + "PASSWORD": os.environ.get("DB_PASSWORD", ""), |
| 25 | + # PostgreSQL password |
| 26 | + "HOST": os.environ.get("DB_HOST", "localhost"), # Database server |
| 27 | + "PORT": os.environ.get("DB_PORT", ""), # Database port (leave blank for default) |
| 28 | +} |
| 29 | + |
| 30 | +# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file. |
| 31 | +# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and |
| 32 | +# symbols. NetBox will not run without this defined. For more information, see |
| 33 | +# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SECRET_KEY |
| 34 | +SECRET_KEY = os.environ.get("SECRET_KEY", "") |
| 35 | + |
| 36 | +# Redis database settings. The Redis database is used for caching and background processing such as webhooks |
| 37 | +# Seperate sections for webhooks and caching allow for connecting to seperate Redis instances/datbases if desired. |
| 38 | +# Full connection details are required in both sections, even if they are the same. |
| 39 | +REDIS = { |
| 40 | + "caching": { |
| 41 | + "HOST": os.environ.get("REDIS_HOST", "redis"), |
| 42 | + "PORT": int(os.environ.get("REDIS_PORT", 6379)), |
| 43 | + "PASSWORD": os.environ.get("REDIS_PASSWORD", ""), |
| 44 | + "DATABASE": 1, |
| 45 | + "DEFAULT_TIMEOUT": 300, |
| 46 | + "SSL": bool(os.environ.get("REDIS_SSL", False)), |
| 47 | + }, |
| 48 | + "tasks": { |
| 49 | + "HOST": os.environ.get("REDIS_HOST", "redis"), |
| 50 | + "PORT": int(os.environ.get("REDIS_PORT", 6379)), |
| 51 | + "PASSWORD": os.environ.get("REDIS_PASSWORD", ""), |
| 52 | + "DATABASE": 0, |
| 53 | + "DEFAULT_TIMEOUT": 300, |
| 54 | + "SSL": bool(os.environ.get("REDIS_SSL", False)), |
| 55 | + }, |
| 56 | +} |
| 57 | + |
| 58 | + |
| 59 | +######################### |
| 60 | +# # |
| 61 | +# Optional settings # |
| 62 | +# # |
| 63 | +######################### |
| 64 | + |
| 65 | +# Specify one or more name and email address tuples representing NetBox administrators. These people will be notified of |
| 66 | +# application errors (assuming correct email settings are provided). |
| 67 | +ADMINS = [ |
| 68 | + # ['John Doe', '[email protected]'], |
| 69 | +] |
| 70 | + |
| 71 | +# Optionally display a persistent banner at the top and/or bottom of every page. HTML is allowed. To display the same |
| 72 | +# content in both banners, define BANNER_TOP and set BANNER_BOTTOM = BANNER_TOP. |
| 73 | +BANNER_TOP = os.environ.get("BANNER_TOP", None) |
| 74 | +BANNER_BOTTOM = os.environ.get("BANNER_BOTTOM", None) |
| 75 | + |
| 76 | +# Text to include on the login page above the login form. HTML is allowed. |
| 77 | +BANNER_LOGIN = os.environ.get("BANNER_LOGIN", "") |
| 78 | + |
| 79 | +# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set: |
| 80 | +# BASE_PATH = 'netbox/' |
| 81 | +BASE_PATH = os.environ.get("BASE_PATH", "") |
| 82 | + |
| 83 | +# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90) |
| 84 | +CHANGELOG_RETENTION = int(os.environ.get("CHANGELOG_RETENTION", 0)) |
| 85 | + |
| 86 | +# API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be |
| 87 | +# allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or |
| 88 | +# CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers |
| 89 | +CORS_ORIGIN_ALLOW_ALL = True |
| 90 | +CORS_ORIGIN_WHITELIST = [] |
| 91 | +CORS_ORIGIN_REGEX_WHITELIST = [] |
| 92 | + |
| 93 | +# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal |
| 94 | +# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging |
| 95 | +# on a production system. |
| 96 | +DEBUG = True |
| 97 | +DEVELOPER = True |
| 98 | + |
| 99 | +# Email settings |
| 100 | +EMAIL = { |
| 101 | + "SERVER": "localhost", |
| 102 | + "PORT": 25, |
| 103 | + "USERNAME": "", |
| 104 | + "PASSWORD": "", |
| 105 | + "TIMEOUT": 10, |
| 106 | + "FROM_EMAIL": "", |
| 107 | +} |
| 108 | + |
| 109 | +# Enforcement of unique IP space can be toggled on a per-VRF basis. |
| 110 | +# To enforce unique IP space within the global table (all prefixes and IP addresses not assigned to a VRF), |
| 111 | +# set ENFORCE_GLOBAL_UNIQUE to True. |
| 112 | +ENFORCE_GLOBAL_UNIQUE = False |
| 113 | + |
| 114 | +# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs: |
| 115 | +# https://docs.djangoproject.com/en/1.11/topics/logging/ |
| 116 | +LOGGING = {} |
| 117 | + |
| 118 | +# Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users |
| 119 | +# are permitted to access most data in NetBox (excluding secrets) but not make any changes. |
| 120 | +LOGIN_REQUIRED = False |
| 121 | + |
| 122 | +# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set: |
| 123 | +# BASE_PATH = 'netbox/' |
| 124 | +BASE_PATH = os.environ.get("BASE_PATH", "") |
| 125 | + |
| 126 | +# Setting this to True will display a "maintenance mode" banner at the top of every page. |
| 127 | +MAINTENANCE_MODE = os.environ.get("MAINTENANCE_MODE", False) |
| 128 | + |
| 129 | +# An API consumer can request an arbitrary number of objects =by appending the "limit" parameter to the URL (e.g. |
| 130 | +# "?limit=1000"). This setting defines the maximum limit. Setting it to 0 or None will allow an API consumer to request |
| 131 | +# all objects by specifying "?limit=0". |
| 132 | +MAX_PAGE_SIZE = int(os.environ.get("MAX_PAGE_SIZE", 1000)) |
| 133 | + |
| 134 | +# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that |
| 135 | +# the default value of this setting is derived from the installed location. |
| 136 | +MEDIA_ROOT = os.environ.get("MEDIA_ROOT", os.path.join(BASE_DIR, "media")) |
| 137 | + |
| 138 | +NAPALM_USERNAME = os.environ.get("NAPALM_USERNAME", "") |
| 139 | +NAPALM_PASSWORD = os.environ.get("NAPALM_PASSWORD", "") |
| 140 | + |
| 141 | +# NAPALM timeout (in seconds). (Default: 30) |
| 142 | +NAPALM_TIMEOUT = os.environ.get("NAPALM_TIMEOUT", 30) |
| 143 | + |
| 144 | +# NAPALM optional arguments (see http://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must |
| 145 | +# be provided as a dictionary. |
| 146 | +NAPALM_ARGS = { |
| 147 | + "secret": NAPALM_PASSWORD, |
| 148 | + # Include any additional args here |
| 149 | +} |
| 150 | + |
| 151 | +# Determine how many objects to display per page within a list. (Default: 50) |
| 152 | +PAGINATE_COUNT = os.environ.get("PAGINATE_COUNT", 50) |
| 153 | + |
| 154 | +# Enable installed plugins. Add the name of each plugin to the list. |
| 155 | +PLUGINS = ["netbox_onboarding"] |
| 156 | + |
| 157 | +# Plugins configuration settings. These settings are used by various plugins that the user may have installed. |
| 158 | +# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings. |
| 159 | +PLUGINS_CONFIG = {"netbox_sotagg": {"github_repo": "networktocode-llc/gizmo-sot"}} |
| 160 | + |
| 161 | +# When determining the primary IP address for a device, IPv6 is preferred over IPv4 by default. Set this to True to |
| 162 | +# prefer IPv4 instead. |
| 163 | +PREFER_IPV4 = os.environ.get("PREFER_IPV4", False) |
| 164 | + |
| 165 | +# Remote authentication support |
| 166 | +REMOTE_AUTH_ENABLED = False |
| 167 | +REMOTE_AUTH_BACKEND = "utilities.auth_backends.RemoteUserBackend" |
| 168 | +REMOTE_AUTH_HEADER = "HTTP_REMOTE_USER" |
| 169 | +REMOTE_AUTH_AUTO_CREATE_USER = True |
| 170 | +REMOTE_AUTH_DEFAULT_GROUPS = [] |
| 171 | +REMOTE_AUTH_DEFAULT_PERMISSIONS = [] |
| 172 | + |
| 173 | +# This determines how often the GitHub API is called to check the latest release of NetBox. Must be at least 1 hour. |
| 174 | +RELEASE_CHECK_TIMEOUT = 24 * 3600 |
| 175 | + |
| 176 | +# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the |
| 177 | +# version check or use the URL below to check for release in the official NetBox repository. |
| 178 | +RELEASE_CHECK_URL = None |
| 179 | +# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases' |
| 180 | + |
| 181 | +SESSION_FILE_PATH = None |
| 182 | + |
| 183 | +# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of |
| 184 | +# this setting is derived from the installed location. |
| 185 | +REPORTS_ROOT = os.environ.get("REPORTS_ROOT", os.path.join(BASE_DIR, "reports")) |
| 186 | + |
| 187 | +# Time zone (default: UTC) |
| 188 | +TIME_ZONE = os.environ.get("TIME_ZONE", "UTC") |
| 189 | + |
| 190 | +# Date/time formatting. See the following link for supported formats: |
| 191 | +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date |
| 192 | +DATE_FORMAT = os.environ.get("DATE_FORMAT", "N j, Y") |
| 193 | +SHORT_DATE_FORMAT = os.environ.get("SHORT_DATE_FORMAT", "Y-m-d") |
| 194 | +TIME_FORMAT = os.environ.get("TIME_FORMAT", "g:i a") |
| 195 | +SHORT_TIME_FORMAT = os.environ.get("SHORT_TIME_FORMAT", "H:i:s") |
| 196 | +DATETIME_FORMAT = os.environ.get("DATETIME_FORMAT", "N j, Y g:i a") |
| 197 | +SHORT_DATETIME_FORMAT = os.environ.get("SHORT_DATETIME_FORMAT", "Y-m-d H:i") |
0 commit comments