@@ -37,9 +37,9 @@ def read_secret(secret_name):
37
37
# PostgreSQL password
38
38
'HOST' : os .environ .get ('DB_HOST' , 'localhost' ), # Database server
39
39
'PORT' : os .environ .get ('DB_PORT' , '' ), # Database port (leave blank for default)
40
- 'OPTIONS' : {'sslmode' : os .environ .get ('DB_SSLMODE' , 'prefer' )},
40
+ 'OPTIONS' : {'sslmode' : os .environ .get ('DB_SSLMODE' , 'prefer' )},
41
41
# Database connection SSLMODE
42
- 'CONN_MAX_AGE' : int (os .environ .get ('DB_CONN_MAX_AGE' , '300' )),
42
+ 'CONN_MAX_AGE' : int (os .environ .get ('DB_CONN_MAX_AGE' , '300' )),
43
43
# Database connection persistence
44
44
}
45
45
@@ -51,13 +51,22 @@ def read_secret(secret_name):
51
51
52
52
# Redis database settings. The Redis database is used for caching and background processing such as webhooks
53
53
REDIS = {
54
- 'HOST' : os .environ .get ('REDIS_HOST' , 'localhost' ),
55
- 'PORT' : int (os .environ .get ('REDIS_PORT' , 6379 )),
56
- 'PASSWORD' : os .environ .get ('REDIS_PASSWORD' , read_secret ('redis_password' )),
57
- 'DATABASE' : os .environ .get ('REDIS_DATABASE' , '0' ),
58
- 'CACHE_DATABASE' : os .environ .get ('REDIS_CACHE_DATABASE' , '1' ),
59
- 'DEFAULT_TIMEOUT' : os .environ .get ('REDIS_TIMEOUT' , '300' ),
60
- 'SSL' : os .environ .get ('REDIS_SSL' , 'False' ).lower () == 'true' ,
54
+ 'webhooks' : {
55
+ 'HOST' : os .environ .get ('REDIS_HOST' , 'localhost' ),
56
+ 'PORT' : int (os .environ .get ('REDIS_PORT' , 6379 )),
57
+ 'PASSWORD' : os .environ .get ('REDIS_PASSWORD' , read_secret ('redis_password' )),
58
+ 'DATABASE' : int (os .environ .get ('REDIS_DATABASE' , 0 )),
59
+ 'DEFAULT_TIMEOUT' : int (os .environ .get ('REDIS_TIMEOUT' , 300 )),
60
+ 'SSL' : os .environ .get ('REDIS_SSL' , 'False' ).lower () == 'true' ,
61
+ },
62
+ 'caching' : {
63
+ 'HOST' : os .environ .get ('REDIS_CACHE_HOST' , os .environ .get ('REDIS_HOST' , 'localhost' )),
64
+ 'PORT' : int (os .environ .get ('REDIS_CACHE_PORT' , os .environ .get ('REDIS_PORT' , 6379 ))),
65
+ 'PASSWORD' : os .environ .get ('REDIS_CACHE_PASSWORD' , os .environ .get ('REDIS_PASSWORD' , read_secret ('redis_cache_password' ))),
66
+ 'DATABASE' : int (os .environ .get ('REDIS_CACHE_DATABASE' , 1 )),
67
+ 'DEFAULT_TIMEOUT' : int (os .environ .get ('REDIS_CACHE_TIMEOUT' , os .environ .get ('REDIS_TIMEOUT' , 300 ))),
68
+ 'SSL' : os .environ .get ('REDIS_CACHE_SSL' , os .environ .get ('REDIS_SSL' , 'False' )).lower () == 'true' ,
69
+ },
61
70
}
62
71
63
72
#########################
@@ -172,10 +181,6 @@ def read_secret(secret_name):
172
181
# Time zone (default: UTC)
173
182
TIME_ZONE = os .environ .get ('TIME_ZONE' , 'UTC' )
174
183
175
- # The Webhook event backend is disabled by default. Set this to True to enable it. Note that this requires a Redis
176
- # database be configured and accessible by NetBox (see `REDIS` below).
177
- WEBHOOKS_ENABLED = os .environ .get ('WEBHOOKS_ENABLED' , 'False' ).lower () == 'true'
178
-
179
184
# Date/time formatting. See the following link for supported formats:
180
185
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
181
186
DATE_FORMAT = os .environ .get ('DATE_FORMAT' , 'N j, Y' )
0 commit comments