From d288923969ed996283022c27ea5cfac58c4daa75 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Thu, 23 Dec 2021 07:19:37 +0100 Subject: [PATCH] get redis database mapping from libs.defaults --- bundles/grafana/files/grafana.ini | 5 ----- bundles/netbox/files/configuration.py | 4 ++-- bundles/pretalx/files/pretalx.cfg | 6 +++--- bundles/rspamd/files/local.d/redis.conf | 1 + libs/defaults.py | 8 ++++++++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bundles/grafana/files/grafana.ini b/bundles/grafana/files/grafana.ini index 0a3fdd2..507160f 100644 --- a/bundles/grafana/files/grafana.ini +++ b/bundles/grafana/files/grafana.ini @@ -29,12 +29,7 @@ type = sqlite3 ;cache_mode = private [remote_cache] -% if node.has_bundle('redis'): -type = redis -connstr = addr=127.0.0.1:6379 -% else: type = database -% endif [analytics] reporting_enabled = false diff --git a/bundles/netbox/files/configuration.py b/bundles/netbox/files/configuration.py index 5a844cd..ccca457 100644 --- a/bundles/netbox/files/configuration.py +++ b/bundles/netbox/files/configuration.py @@ -15,7 +15,7 @@ REDIS = { 'HOST': 'localhost', 'PORT': 6379, 'PASSWORD': '', - 'DATABASE': 0, + 'DATABASE': ${repo.libs.defaults.redis_databases['netbox'][0]}, 'DEFAULT_TIMEOUT': 300, 'SSL': False, }, @@ -23,7 +23,7 @@ REDIS = { 'HOST': 'localhost', 'PORT': 6379, 'PASSWORD': '', - 'DATABASE': 1, + 'DATABASE': ${repo.libs.defaults.redis_databases['netbox'][1]}, 'DEFAULT_TIMEOUT': 300, 'SSL': False, } diff --git a/bundles/pretalx/files/pretalx.cfg b/bundles/pretalx/files/pretalx.cfg index 602c518..0575982 100644 --- a/bundles/pretalx/files/pretalx.cfg +++ b/bundles/pretalx/files/pretalx.cfg @@ -25,10 +25,10 @@ ssl = False % if node.has_bundle('redis'): [celery] -backend = redis://127.0.0.1/1 -broker = redis://127.0.0.1/2 +backend = redis://127.0.0.1/${repo.libs.defaults.redis_databases['pretalx'][0]} +broker = redis://127.0.0.1/${repo.libs.defaults.redis_databases['pretalx'][1]} [redis] -location = redis://@127.0.0.1:6379/3 +location = redis://@127.0.0.1:6379/${repo.libs.defaults.redis_databases['pretalx'][2]} session = True % endif diff --git a/bundles/rspamd/files/local.d/redis.conf b/bundles/rspamd/files/local.d/redis.conf index 5a9c582..1aa652b 100644 --- a/bundles/rspamd/files/local.d/redis.conf +++ b/bundles/rspamd/files/local.d/redis.conf @@ -1 +1,2 @@ servers = "127.0.0.1"; +db = "${repo.libs.defaults.redis_databases['rspamd']} diff --git a/libs/defaults.py b/libs/defaults.py index cfa7221..3d274ac 100644 --- a/libs/defaults.py +++ b/libs/defaults.py @@ -5,5 +5,13 @@ influxdb_org = 'encrypt$gAAAAABgg9hyjz4XtvG8NBw9uYxiumS3v7YKIrtc9tTTABg1f9R22gzn influxdb_token = 'encrypt$gAAAAABgg9Ag632Xyuc6SWXaR1uH2tLOChmVKAoBIikhjntSSD2qJFL_eouVQGXCLH2HEuSbSdEXcTPn2qmhOiA9jmFdoDSbVbQUsp0EID1wLsWYG_Um2KOxZSF-tn9eDZlgShQYySjzO3nQRmdlJpVLUnGHsiwv_sHD2FstXGpfzTPZq5_egUqEc0K2X-aN2J6BTYc2fZAN' influxdb_url = 'https://influxdb.kunsmann.eu/' +# FIXME database conflicts +redis_databases = { + 'netbox': (0, 1), + 'rspamd': 0, + 'paperless-ng': None, # probably 0, but undocumented + 'pretalx': (1, 2, 3), +} + security_email = f'mailto:{hostmaster_email}' security_lang = {'en', 'de'}