aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Amrou Bellalouna <[email protected]>2023-04-01 20:02:12 +0100
committerGravatar GitHub <[email protected]>2023-04-01 20:02:12 +0100
commit515e5c8fca4734068746026cb9b1a78014368966 (patch)
tree0482eac86576f4836762cbb8c2b0ad8a9cd33e50
parentMerge pull request #2503 from python-discord/update_ping_cooldown (diff)
parentMerge branch 'main' into shtlrs/get-rid-of-site-config-var (diff)
Merge pull request #2489 from shtlrs/shtlrs/get-rid-of-site-config-var
Remove usage of `site` config variable
-rw-r--r--bot/__main__.py2
-rw-r--r--bot/constants.py14
-rw-r--r--bot/exts/filters/antimalware.py6
-rw-r--r--bot/exts/utils/ping.py2
-rw-r--r--docker-compose.yml2
5 files changed, 10 insertions, 16 deletions
diff --git a/bot/__main__.py b/bot/__main__.py
index c8843e1a3..8b640a370 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -66,7 +66,7 @@ async def main() -> None:
intents=intents,
allowed_roles=list({discord.Object(id_) for id_ in constants.MODERATION_ROLES}),
api_client=APIClient(
- site_api_url=f"{constants.URLs.site_api_schema}{constants.URLs.site_api}",
+ site_api_url=constants.URLs.site_api,
site_api_token=constants.Keys.site_api,
),
)
diff --git a/bot/constants.py b/bot/constants.py
index 71e9bc160..9df2a0950 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -531,10 +531,8 @@ class _BaseURLs(EnvConfig):
github_bot_repo = "https://github.com/python-discord/bot"
# Site
- site = "pythondiscord.com"
- site_schema = "https://"
- site_api = "site.default.svc.cluster.local/api"
- site_api_schema = "http://"
+ site_api = "http://site.default.svc.cluster.local/api"
+ site_paste = "https://paste.pythondiscord.com"
BaseURLs = _BaseURLs()
@@ -549,12 +547,8 @@ class _URLs(_BaseURLs):
connect_max_retries = 3
connect_cooldown = 5
- site_staff: str = "".join([BaseURLs.site_schema, BaseURLs.site, "/staff"])
- site_paste = "".join(["paste.", BaseURLs.site])
-
- # Site endpoints
- site_logs_view: str = "".join([BaseURLs.site_schema, BaseURLs.site, "/staff/bot/logs"])
- paste_service: str = "".join([BaseURLs.site_schema, "paste.", BaseURLs.site, "/{key}"])
+ paste_service: str = "".join([BaseURLs.site_paste, "/{key}"])
+ site_logs_view: str = "https://pythondiscord.com/staff/bot/logs"
URLs = _URLs()
diff --git a/bot/exts/filters/antimalware.py b/bot/exts/filters/antimalware.py
index ff39700a6..0a72a6db7 100644
--- a/bot/exts/filters/antimalware.py
+++ b/bot/exts/filters/antimalware.py
@@ -5,7 +5,7 @@ from discord import Embed, Message, NotFound
from discord.ext.commands import Cog
from bot.bot import Bot
-from bot.constants import Channels, Filter, URLs
+from bot.constants import BaseURLs, Channels, Filter
from bot.exts.events.code_jams._channels import CATEGORY_NAME as JAM_CATEGORY_NAME
from bot.log import get_logger
@@ -13,13 +13,13 @@ log = get_logger(__name__)
PY_EMBED_DESCRIPTION = (
"It looks like you tried to attach a Python file - "
- f"please use a code-pasting service such as {URLs.site_schema}{URLs.site_paste}"
+ f"please use a code-pasting service such as {BaseURLs.site_paste}"
)
TXT_LIKE_FILES = {".txt", ".csv", ".json"}
TXT_EMBED_DESCRIPTION = (
"You either uploaded a `{blocked_extension}` file or entered a message that was too long. "
- f"Please use our [paste bin]({URLs.site_schema}{URLs.site_paste}) instead."
+ f"Please use our [paste bin]({BaseURLs.site_paste}) instead."
)
DISALLOWED_EMBED_DESCRIPTION = (
diff --git a/bot/exts/utils/ping.py b/bot/exts/utils/ping.py
index 67a960365..edac4ebca 100644
--- a/bot/exts/utils/ping.py
+++ b/bot/exts/utils/ping.py
@@ -38,7 +38,7 @@ class Latency(commands.Cog):
bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms"
try:
- async with self.bot.http_session.get(f"{URLs.site_api_schema}{URLs.site_api}/healthcheck") as request:
+ async with self.bot.http_session.get(f"{URLs.site_api}/healthcheck") as request:
request.raise_for_status()
site_status = "Healthy"
diff --git a/docker-compose.yml b/docker-compose.yml
index 694f44507..5f3fbf5ba 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -113,7 +113,7 @@ services:
- .env
environment:
API_KEYS_SITE_API: "badbot13m0n8f570f942013fc818f234916ca531"
- URLS_SITE_API: "web:8000/api"
+ URLS_SITE_API: "http://web:8000/api"
URLS_SNEKBOX_EVAL_API: "http://snekbox/eval"
URLS_SNEKBOX_311_EVAL_API: "http://snekbox-311/eval"
REDIS_HOST: "redis"