aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/constants.py3
-rw-r--r--bot/utils/redis_dict.py7
-rw-r--r--config-default.yml2
3 files changed, 11 insertions, 1 deletions
diff --git a/bot/constants.py b/bot/constants.py
index fd280e9de..01e8ac3a3 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -199,6 +199,9 @@ class Bot(metaclass=YAMLGetter):
prefix: str
token: str
sentry_dsn: str
+ redis_host: str
+ redis_port: int
+
class Filter(metaclass=YAMLGetter):
section = "filter"
diff --git a/bot/utils/redis_dict.py b/bot/utils/redis_dict.py
index c89765a24..dfb1c7252 100644
--- a/bot/utils/redis_dict.py
+++ b/bot/utils/redis_dict.py
@@ -7,6 +7,8 @@ from typing import Dict, List, Optional, Tuple, Union
import redis as redis_py
+from bot import constants
+
ValidRedisKey = Union[str, int, float]
JSONSerializableType = Optional[Union[str, float, bool, Dict, List, Tuple, Enum]]
@@ -24,7 +26,10 @@ class RedisDict(MutableMapping):
"""
_namespaces = []
- _redis = redis_py.Redis(host="redis") # Can be overridden for testing
+ _redis = redis_py.Redis(
+ host=constants.Bot.redis_host,
+ port=constants.Bot.redis_port,
+ ) # Can be overridden for testing
def __init__(self, namespace: Optional[str] = None) -> None:
"""Initialize the RedisDict with the right namespace."""
diff --git a/config-default.yml b/config-default.yml
index 83ea59016..722afa41b 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -2,6 +2,8 @@ bot:
prefix: "!"
token: !ENV "BOT_TOKEN"
sentry_dsn: !ENV "BOT_SENTRY_DSN"
+ redis_host: "redis"
+ redis_port: 6379
stats:
statsd_host: "graphite"