aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
Diffstat (limited to 'bot')
-rw-r--r--bot/__main__.py8
-rw-r--r--bot/constants.py19
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: