diff options
| author | 2021-08-22 11:38:14 +0100 | |
|---|---|---|
| committer | 2021-08-22 11:38:14 +0100 | |
| commit | 30bcc28b2caf90ac6ed0e2f5df530c617ba03b4a (patch) | |
| tree | dd48f4900208eb111481d79653fd9494df02d231 | |
| parent | Move metabase error handling to a cog error handler (diff) | |
Change metabase config to base url, rather than api url
| -rw-r--r-- | bot/constants.py | 2 | ||||
| -rw-r--r-- | bot/exts/moderation/metabase.py | 4 | ||||
| -rw-r--r-- | config-default.yml | 10 |
3 files changed, 7 insertions, 9 deletions
diff --git a/bot/constants.py b/bot/constants.py index 500803f33..12b5c02e5 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -568,7 +568,7 @@ class Metabase(metaclass=YAMLGetter): username: Optional[str] password: Optional[str] - url: str + base_url: str max_session_age: int diff --git a/bot/exts/moderation/metabase.py b/bot/exts/moderation/metabase.py index 80dabbbb0..bfa94b7c1 100644 --- a/bot/exts/moderation/metabase.py +++ b/bot/exts/moderation/metabase.py @@ -84,7 +84,7 @@ class Metabase(Cog): "username": MetabaseConfig.username, "password": MetabaseConfig.password } - async with self.bot.http_session.post(f"{MetabaseConfig.url}/session", json=data) as resp: + async with self.bot.http_session.post(f"{MetabaseConfig.base_url}/api/session", json=data) as resp: json_data = await resp.json() self.session_token = json_data.get("id") @@ -130,7 +130,7 @@ class Metabase(Cog): # Make sure we have a session token before running anything await self.init_task - url = f"{MetabaseConfig.url}/card/{question_id}/query/{extension}" + url = f"{MetabaseConfig.base_url}/api/card/{question_id}/query/{extension}" async with self.bot.http_session.post(url, headers=self.headers, raise_for_status=True) as resp: if extension == "csv": diff --git a/config-default.yml b/config-default.yml index 881a7df76..79828dd77 100644 --- a/config-default.yml +++ b/config-default.yml @@ -432,14 +432,12 @@ anti_spam: max: 3 - metabase: - username: !ENV "METABASE_USERNAME" - password: !ENV "METABASE_PASSWORD" - url: "http://metabase.default.svc.cluster.local/api" + username: !ENV "METABASE_USERNAME" + password: !ENV "METABASE_PASSWORD" + base_url: "http://metabase.default.svc.cluster.local" # 14 days, see https://www.metabase.com/docs/latest/operations-guide/environment-variables.html#max_session_age - max_session_age: 20160 - + max_session_age: 20160 big_brother: |