feat(bot): Update stuff to migrate to k8s.
This commit is contained in:
+3
-21
@@ -29,29 +29,11 @@ from payphone.core import (
|
||||
|
||||
|
||||
class Payphone(commands.AutoShardedBot):
|
||||
shutdown: managers.ValueProxy[bool]
|
||||
"""A value proxy that connects with all other shard processes.
|
||||
|
||||
This value is shared between shard processes, and if any of them sets this proxy's value to
|
||||
`True`, then all shard processes will be terminated by the main process (`run.py`).
|
||||
|
||||
To check if the shutdown has been scheduled (but not necessarily is immediately about to
|
||||
occur), use `scheduled_shutdown` instead.
|
||||
"""
|
||||
|
||||
scheduled_shutdown: managers.ValueProxy[bool]
|
||||
"""A value proxy that connects with all other shard processes.
|
||||
|
||||
This value is shared between shard processes, and if any of them sets this proxy's value to
|
||||
`True`, then the bot's shutdown has been started and all shards will be terminated soon.
|
||||
|
||||
To check whether the bot's about to terminate (if the message was sent to the main process) use
|
||||
`shutdown`.
|
||||
"""
|
||||
|
||||
log = logging.logger
|
||||
|
||||
redis: aredis.Redis = aredis.Redis(host="localhost" if config.IS_DEBUG else "redis")
|
||||
redis: aredis.Redis = aredis.Redis(
|
||||
host="localhost" if config.IS_DEBUG else "redis.default.svc.cluster.local"
|
||||
)
|
||||
|
||||
def __init__(self) -> None:
|
||||
intents = discord.Intents.default()
|
||||
|
||||
@@ -7,6 +7,9 @@ load_dotenv()
|
||||
|
||||
TOKEN = os.getenv("TOKEN")
|
||||
|
||||
SHARD_ID = int(os.getenv("SHARD_ID", "0"))
|
||||
SHARD_COUNT = int(os.getenv("SHARD_COUNT", "1"))
|
||||
|
||||
IS_DEBUG = os.environ.get("IS_DEBUG", "false") == "true"
|
||||
|
||||
TORTOISE_ORM = {
|
||||
@@ -14,7 +17,7 @@ TORTOISE_ORM = {
|
||||
"default": {
|
||||
"engine": "tortoise.backends.asyncpg",
|
||||
"credentials": {
|
||||
"host": "localhost" if IS_DEBUG else "database",
|
||||
"host": "localhost" if IS_DEBUG else "citus-loadbalancer.default.svc.cluster.local",
|
||||
"port": "5432",
|
||||
"user": "payphone",
|
||||
"password": "payphone",
|
||||
|
||||
Reference in New Issue
Block a user