Skip to content

Commit 338e8d5

Browse files
committed
Make the hackbot UI's address a setting
The apply-side Slack handler had it as a module constant, which was fine while it was the only thing linking to a run page. It is about to stop being: the Slack receiver links to one too, when it tells a clicker where the run their click collapsed onto already is. A second copy of a hardcoded host is the kind of thing that stays consistent right up until it does not, so this makes it `settings.hackbot_ui_url` before there is a second copy rather than after. Unlike `hackbot_api_url` next to it, this address is never called, only linked, so the deployed UI is the right default even when running locally: a local link would be dead for whoever reads the message it lands in.
1 parent 6221eba commit 338e8d5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎services/hackbot-api/app/action_handlers/slack_handler.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
from slack_sdk import WebClient
1515

1616
from app.action_handlers.base import ActionResult, ApplyContext
17+
from app.config import settings
1718

1819
log = logging.getLogger(__name__)
1920

20-
_HACKBOT_UI_URL = "https://hackbot.moz.tools"
21-
2221
_TIMEOUT_SECONDS = 30
2322

2423

@@ -41,7 +40,7 @@ async def apply(self, params: dict[str, Any], ctx: ApplyContext) -> ActionResult
4140
"notification_type": "info",
4241
"source": {
4342
"ref_id": ctx.run_id,
44-
"ref_url": f"{_HACKBOT_UI_URL}/runs/{ctx.run_id}",
43+
"ref_url": f"{settings.hackbot_ui_url}/runs/{ctx.run_id}",
4544
},
4645
"context": {
4746
"agent": ctx.agent,

‎services/hackbot-api/app/config.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class Settings(BaseSettings):
9494
# is just a matter of repointing this at the remote API. While co-located,
9595
# this is a loopback call to the same service, authed with external_api_key.
9696
hackbot_api_url: str = "http://localhost:8080"
97+
hackbot_ui_url: str = "https://hackbot.moz.tools"
9798

9899
# Internal event routes (Eventarc / Pub/Sub push targets).
99100
# Event topics follow a per-domain convention, `<domain>-events` (the GCP

0 commit comments

Comments
 (0)