Removed API_BASE_URL and replaced with SITE_BASE_URL #458
No reviewers
Labels
No labels
Kestra
bug
enhancement
someday
subtask
☁️ api
🎛️ infrastructure
🐞 sentry
📆 2025 Season
📝 pages
allpicks
📝 pages
picks
📝 pages
standings
🚀 performance
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web!458
Loading…
Reference in a new issue
No description provided.
Delete branch "add-site-base-url-to-config-456"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #456
Resolves #452
This is a clean, well-scoped refactor: a single hardcoded host (
https://tgfp.us) and a now-unusedAPI_BASE_URLare replaced by oneSITE_BASE_URLconfig value threaded through the jobs and mailer, and the config plumbing (config.py,op.env,sample.env, test seeding) is updated consistently. I found no correctness or security problems — the notes below are minor.Worth fixing
app/jobs/nag_players.py:17—NagBotExceptionis introduced in this PR but never raised, caught, or imported anywhere (confirmed by grep). It's dead code. Either wire it intonag_the_players(e.g. thefirst_game is None/ no-current-week paths) or drop it.Nits
app/jobs/nag_players.py:55— the newif player.discord_id is not None:guard is redundant:_get_late_playersalready skips anyone without a Discord id (if not player.has_discord_id: continueat line 35), solate_playersnever contains a player who would emit<@None>. Harmless, just belt-and-suspenders that can mislead a future reader into thinking the upstream filter is unreliable.Trailing-slash fragility — the URL is assembled by string concatenation in several places (
config.SITE_BASE_URL + "/picks"inannounce_picks_page.py:18andnag_players.py:46;f"{url}/rules"inmailer.py:52;f"{url}/static/..."inaward_notify_discord.py:23). All of these assumeSITE_BASE_URLhas no trailing slash. The committedsample.env/op.envvalues are fine, but a value likehttps://tgfp.us/silently yieldshttps://tgfp.us//picks. Not worth abstracting for four call sites, but worth a one-line comment on the config field, or an.rstrip("/")when reading it inconfig.py.tests/test_integrity.py:13— the docstring still citesKeyError: 'API_BASE_URL'as the example of what a missing config raises; that key no longer exists. Update to a current field (or a generic phrasing) so the comment doesn't send someone chasing a removed variable.Docstring wording regressed from "picks page" to "pick page" in
app/jobs/announce_picks_page.py:44andapp/mailer.py:64. Cosmetic, but the original read better.No test asserts the URLs now come from
config.SITE_BASE_URL(the conftest seeds it as the placeholdertest-SITE_BASE_URL, so a test could cheaply pin the substitution in the nag/announce/mailer payloads). Given the existing coverage of these jobs, adding one assertion would lock in the behavior this PR is specifically about.One thing worth calling out as a positive: switching
send_welcome_emailoffrequest.url_for(...)removes the last reason it needed aRequest, which is what lets the admin "resend welcome" path (v2.py:519) call it without a synthetic request — consistent with the comment already inmailer.py:45.