From 9b203e6f9eccc71644b76900c2a7b7084d6a240c Mon Sep 17 00:00:00 2001 From: shtlrs Date: Mon, 1 May 2023 14:26:15 +0100 Subject: update Redis config This also renames RedisConfig to Redis, the way we have it in Python --- bot/constants.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 5f853521..81db539a 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -21,7 +21,7 @@ __all__ = ( "Tokens", "Wolfram", "Reddit", - "RedisConfig", + "Redis", "RedirectOutput", "PYTHON_PREFIX", "MODERATION_ROLES", @@ -321,17 +321,16 @@ class _Wolfram(EnvConfig): Wolfram = _Wolfram() -class Wolfram(NamedTuple): - user_limit_day = int(environ.get("WOLFRAM_USER_LIMIT_DAY", 10)) - guild_limit_day = int(environ.get("WOLFRAM_GUILD_LIMIT_DAY", 67)) - key = environ.get("WOLFRAM_API_KEY") +class _Redis(EnvConfig): + EnvConfig.Config.env_prefix = "redis_" + host = "redis.default.svc.cluster.local" + port = 6379 + password = "" + use_fakeredis = False -class RedisConfig(NamedTuple): - host = environ.get("REDIS_HOST", "redis.default.svc.cluster.local") - port = environ.get("REDIS_PORT", 6379) - password = environ.get("REDIS_PASSWORD") - use_fakeredis = environ.get("USE_FAKEREDIS", "false").lower() == "true" + +Redis = _Redis() class Source: -- cgit v1.2.3