ruff.toml has declared `quote-style = "single"` and line-length 120 since the lint job landed, and 118 of 128 files follow it. The panel backend and the netbox configuration were written in black/prettier style instead, so a `ruff format --check` would have failed on them from the start. Bring them onto the style the repository already declares, which is what makes the check adoptable at all. Formatting only: apart from quote style the diff is multi-line expressions joined where they fit inside 120 columns. Both suites still pass afterwards (25 pytest, and ruff check is clean). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
import os
|
|
|
|
|
|
def _csv(name, default=''):
|
|
return [item.strip() for item in os.environ.get(name, default).split(',') if item.strip()]
|
|
|
|
|
|
ALLOWED_HOSTS = _csv('ALLOWED_HOSTS', 'localhost,127.0.0.1,[::1]')
|
|
CSRF_TRUSTED_ORIGINS = _csv('CSRF_TRUSTED_ORIGINS')
|
|
USE_X_FORWARDED_HOST = True
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'NAME': os.environ['DB_NAME'],
|
|
'USER': os.environ['DB_USER'],
|
|
'PASSWORD': os.environ['DB_PASSWORD'],
|
|
'HOST': os.environ['DB_HOST'],
|
|
'PORT': os.environ.get('DB_PORT', '5432'),
|
|
'OPTIONS': {'sslmode': os.environ.get('DB_SSLMODE', 'disable')},
|
|
'CONN_MAX_AGE': int(os.environ.get('DB_CONN_MAX_AGE', '300')),
|
|
}
|
|
}
|
|
|
|
REDIS = {
|
|
'tasks': {
|
|
'HOST': os.environ['REDIS_HOST'],
|
|
'PORT': int(os.environ.get('REDIS_PORT', '6379')),
|
|
'PASSWORD': os.environ['REDIS_PASSWORD'],
|
|
'DATABASE': int(os.environ.get('REDIS_DATABASE', '0')),
|
|
'SSL': False,
|
|
},
|
|
'caching': {
|
|
'HOST': os.environ['REDIS_CACHE_HOST'],
|
|
'PORT': int(os.environ.get('REDIS_CACHE_PORT', '6379')),
|
|
'PASSWORD': os.environ['REDIS_CACHE_PASSWORD'],
|
|
'DATABASE': int(os.environ.get('REDIS_CACHE_DATABASE', '1')),
|
|
'SSL': False,
|
|
},
|
|
}
|
|
|
|
SECRET_KEY = os.environ['SECRET_KEY']
|
|
API_TOKEN_PEPPERS = {1: os.environ['API_TOKEN_PEPPER_1']}
|
|
TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC')
|
|
MEDIA_ROOT = '/opt/netbox/netbox/media'
|
|
REPORTS_ROOT = '/opt/netbox/netbox/reports'
|
|
SCRIPTS_ROOT = '/opt/netbox/netbox/scripts'
|
|
CENSUS_REPORTING_ENABLED = False
|