aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2021-08-26 16:39:04 +0100
committerGravatar Chris Lovering <[email protected]>2021-08-26 16:39:04 +0100
commit78d8bde653187cbf23a2f0ef8a6952058ad95bf4 (patch)
tree14f42d9c92f44a135879f52bb3e5e670e2f50134
parentMerge pull request #1783 from python-discord/user-message-link-support (diff)
Use publically available URL when outputting metabase share URL
In production we use the internal URL to call the metabase API, to avoid egress but we still want to output the public url when giving the sharing link. Making it a constant like this makes it easier to change/overwrite in future if needed.
-rw-r--r--bot/constants.py1
-rw-r--r--bot/exts/moderation/metabase.py2
-rw-r--r--config-default.yml1
3 files changed, 3 insertions, 1 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 80e01b174..4e99df7f3 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -569,6 +569,7 @@ class Metabase(metaclass=YAMLGetter):
username: Optional[str]
password: Optional[str]
base_url: str
+ public_url: str
max_session_age: int
diff --git a/bot/exts/moderation/metabase.py b/bot/exts/moderation/metabase.py
index 3b454ab18..9eeeec074 100644
--- a/bot/exts/moderation/metabase.py
+++ b/bot/exts/moderation/metabase.py
@@ -167,7 +167,7 @@ class Metabase(Cog):
async with self.bot.http_session.post(url, headers=self.headers, raise_for_status=True) as resp:
response_json = await resp.json(encoding="utf-8")
- sharing_url = f"{MetabaseConfig.base_url}/public/question/{response_json['uuid']}"
+ sharing_url = f"{MetabaseConfig.public_url}/public/question/{response_json['uuid']}"
await ctx.send(f":+1: {ctx.author.mention} Here's your sharing link: {sharing_url}")
# This cannot be static (must have a __func__ attribute).
diff --git a/config-default.yml b/config-default.yml
index 8e0b97a51..baece5c51 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -441,6 +441,7 @@ metabase:
username: !ENV "METABASE_USERNAME"
password: !ENV "METABASE_PASSWORD"
base_url: "http://metabase.default.svc.cluster.local"
+ public_url: "https://metabase.pythondiscord.com"
# 14 days, see https://www.metabase.com/docs/latest/operations-guide/environment-variables.html#max_session_age
max_session_age: 20160