diff options
| author | 2023-05-01 14:26:15 +0100 | |
|---|---|---|
| committer | 2023-05-06 13:20:46 +0100 | |
| commit | 9b203e6f9eccc71644b76900c2a7b7084d6a240c (patch) | |
| tree | b12815c2606967e5e9604a18e357ed8c58f6c401 | |
| parent | update Tokens & Wolfram (diff) | |
update Redis config
This also renames RedisConfig to Redis, the way we have it in Python
| -rw-r--r-- | bot/__main__.py | 8 | ||||
| -rw-r--r-- | bot/constants.py | 19 | 
2 files changed, 13 insertions, 14 deletions
| diff --git a/bot/__main__.py b/bot/__main__.py index 970614ce..bd3df263 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -19,11 +19,11 @@ log = logging.getLogger(__name__)  async def _create_redis_session() -> RedisSession:      """Create and connect to a redis session."""      redis_session = RedisSession( -        host=constants.RedisConfig.host, -        port=constants.RedisConfig.port, -        password=constants.RedisConfig.password, +        host=constants.Redis.host, +        port=constants.Redis.port, +        password=constants.Redis.password,          max_connections=20, -        use_fakeredis=constants.RedisConfig.use_fakeredis, +        use_fakeredis=constants.Redis.use_fakeredis,          global_namespace="bot",          decode_responses=True,      ) 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: | 
