Mint short links on piha.lc / beta.piha.li (#12)
Deploy Beta / unit-tests (push) Successful in 21s
Deploy Beta / docker (push) Successful in 24s
Deploy Beta / deploy-beta (push) Successful in 2m4s

## Summary
- Point `SHORTENER_BASE_URL` at `https://piha.lc` (prod) and `https://beta.piha.li` (beta).
- Stop documenting `shortener.aimloperations.com` as the mint host.

Closes #11.

Depends on url_shortening_service serving `/api/` on the short host.

## Test plan
- [ ] Set `SHORTENER_BASE_URL=https://beta.piha.li` and matching token in beta env
- [ ] Compose a campaign SMS and confirm mint hits beta.piha.li (not shortener-beta)
- [ ] Body contains `https://beta.piha.li/<code>`

Reviewed-on: #12
This commit was merged in pull request #12.
This commit is contained in:
2026-08-30 17:27:51 -07:00
parent 2b3f10e784
commit bc7c47a69c
7 changed files with 18 additions and 18 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ long HTTPS URL to `url_shortening_service` (`POST /api/links/`, Bearer
`monica:<secret>`) and puts `short_url` (`https://piha.li/<code>`) in SMS,
email hrefs, and postcard QR codes. Empty env → long UTM URL (local default).
Mint against the **API host**, not `piha.li`. See `.env.example` / `.env.prod.example`.
Mint against the short host (`https://piha.lc` / `https://beta.piha.li`). See `.env.example` / `.env.prod.example`.
SMS correlation uses `message_id` (SMS id), then `destination_number` phone
fallback. Do **not** treat webhook `id` as the SMS id.
+2 -2
View File
@@ -1,6 +1,6 @@
"""Server-to-server client for url_shortening_service (piha.li).
"""Server-to-server client for url_shortening_service (piha.lc).
Call the API host (`SHORTENER_BASE_URL`), never the public short domain.
Call SHORTENER_BASE_URL (https://piha.lc / https://beta.piha.li).
Auth: Authorization: Bearer <SHORTENER_API_TOKEN> (name:secret).
"""
+3 -3
View File
@@ -1598,7 +1598,7 @@ class CampaignUtmLinkTests(TestCase):
}
with self.settings(
PUBLIC_SITE_URL="https://mkdrealtor.com",
SHORTENER_BASE_URL="https://shortener.aimloperations.com",
SHORTENER_BASE_URL="https://piha.lc",
SHORTENER_API_TOKEN="monica:test-token",
):
with patch(
@@ -1630,7 +1630,7 @@ class CampaignUtmLinkTests(TestCase):
mock.text = '{"detail":"Unauthorized"}'
with self.settings(
PUBLIC_SITE_URL="https://mkdrealtor.com",
SHORTENER_BASE_URL="https://shortener.aimloperations.com",
SHORTENER_BASE_URL="https://piha.lc",
SHORTENER_API_TOKEN="monica:bad",
):
with patch("messaging.shortener.requests.post", return_value=mock):
@@ -1687,7 +1687,7 @@ class CampaignUtmLinkTests(TestCase):
url = reverse("messaging:campaign_short_link")
with self.settings(
PUBLIC_SITE_URL="https://mkdrealtor.com",
SHORTENER_BASE_URL="https://shortener.aimloperations.com",
SHORTENER_BASE_URL="https://piha.lc",
SHORTENER_API_TOKEN="monica:test-token",
):
with patch("messaging.shortener.requests.post", return_value=mock):
+3 -3
View File
@@ -332,9 +332,9 @@ NOMINATIM_USER_AGENT = env(
)
NOMINATIM_API_KEY = env("NOMINATIM_API_KEY", "")
# --- URL shortener (piha.li) ---
# Call the API host, never the public short domain. Empty = skip minting
# (composer falls back to the long UTM URL). Token format: name:secret.
# --- URL shortener (piha.lc) ---
# Same host as SMS links. Empty = skip minting (composer falls back to the
# long UTM URL). Token format: name:secret.
SHORTENER_BASE_URL = env("SHORTENER_BASE_URL", "")
SHORTENER_API_TOKEN = env("SHORTENER_API_TOKEN", "")
SHORTENER_TIMEOUT_SECONDS = int(env("SHORTENER_TIMEOUT_SECONDS", "10") or "10")