pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / servers / web-apps / netbox / config.patch
bloba2e0b0b95a871f1f41f995bf6c0d5bf24e36928d
1 diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
2 index 2de06dd10..00406af48 100644
3 --- a/netbox/netbox/settings.py
4 +++ b/netbox/netbox/settings.py
5 @@ -236,6 +236,7 @@ TASKS_REDIS_DATABASE = TASKS_REDIS.get('DATABASE', 0)
6 TASKS_REDIS_SSL = TASKS_REDIS.get('SSL', False)
7 TASKS_REDIS_SKIP_TLS_VERIFY = TASKS_REDIS.get('INSECURE_SKIP_TLS_VERIFY', False)
8 TASKS_REDIS_CA_CERT_PATH = TASKS_REDIS.get('CA_CERT_PATH', False)
9 +TASKS_REDIS_URL = TASKS_REDIS.get('URL')
11 # Caching
12 if 'caching' not in REDIS:
13 @@ -253,11 +254,12 @@ CACHING_REDIS_SENTINEL_SERVICE = REDIS['caching'].get('SENTINEL_SERVICE', 'defau
14 CACHING_REDIS_PROTO = 'rediss' if REDIS['caching'].get('SSL', False) else 'redis'
15 CACHING_REDIS_SKIP_TLS_VERIFY = REDIS['caching'].get('INSECURE_SKIP_TLS_VERIFY', False)
16 CACHING_REDIS_CA_CERT_PATH = REDIS['caching'].get('CA_CERT_PATH', False)
17 +CACHING_REDIS_URL = REDIS['caching'].get('URL', f'{CACHING_REDIS_PROTO}://{CACHING_REDIS_HOST}:{CACHING_REDIS_PORT}/{CACHING_REDIS_DATABASE}')
19 CACHES = {
20 'default': {
21 'BACKEND': 'django_redis.cache.RedisCache',
22 - 'LOCATION': f'{CACHING_REDIS_PROTO}://{CACHING_REDIS_USERNAME_HOST}:{CACHING_REDIS_PORT}/{CACHING_REDIS_DATABASE}',
23 + 'LOCATION': CACHING_REDIS_URL,
24 'OPTIONS': {
25 'CLIENT_CLASS': 'django_redis.client.DefaultClient',
26 'PASSWORD': CACHING_REDIS_PASSWORD,
27 @@ -410,7 +412,7 @@ USE_X_FORWARDED_HOST = True
28 X_FRAME_OPTIONS = 'SAMEORIGIN'
30 # Static files (CSS, JavaScript, Images)
31 -STATIC_ROOT = BASE_DIR + '/static'
32 +STATIC_ROOT = getattr(configuration, 'STATIC_ROOT', os.path.join(BASE_DIR, 'static')).rstrip('/')
33 STATIC_URL = f'/{BASE_PATH}static/'
34 STATICFILES_DIRS = (
35 os.path.join(BASE_DIR, 'project-static', 'dist'),
36 @@ -640,6 +642,14 @@ if TASKS_REDIS_USING_SENTINEL:
37 'socket_connect_timeout': TASKS_REDIS_SENTINEL_TIMEOUT
40 +elif TASKS_REDIS_URL:
41 + RQ_PARAMS = {
42 + 'URL': TASKS_REDIS_URL,
43 + 'PASSWORD': TASKS_REDIS_PASSWORD,
44 + 'SSL': TASKS_REDIS_SSL,
45 + 'SSL_CERT_REQS': None if TASKS_REDIS_SKIP_TLS_VERIFY else 'required',
46 + 'DEFAULT_TIMEOUT': RQ_DEFAULT_TIMEOUT,
47 + }
48 else:
49 RQ_PARAMS = {
50 'HOST': TASKS_REDIS_HOST,