Allow audiusAppUrl to be overridden via env var - #747
Merged
Conversation
The per-env switch in init() hardcoded Cfg.AudiusAppUrl for dev, stage and prod, so the value could not be pointed at a non-default frontend without a code change. Developer apps running against a local override or preview deploy got the wrong redirect_uri base. Apply the env var after the switch, alongside the existing archiverNodes and antiAbuseOracles overrides, so it covers every env and cannot be missed when a new env case is added. Trailing slash is trimmed because all consumers build URLs as base + "/...". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
rickyrombo
force-pushed
the
mjp-audiusappurl-env
branch
from
August 5, 2026 04:29
85d7fda to
24e301d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cfg.AudiusAppUrlwas hardcoded inside the per-envswitchinconfig.init()fordev,stageandprod, so it could not be pointed at a non-default frontend without a code change. Developer apps running against a local override or preview deploy got the wrongredirect_uribase.This applies an
audiusAppUrlenv override after the switch, alongside the existingarchiverNodesandantiAbuseOraclesoverrides that solve the same problem for values the switch also sets per-env:Placing it after the switch means it covers every env and cannot be silently missed when a new env case is added — the earlier revision of this PR guarded
devandprodindividually, and astagedefault added tomainin the meantime went unguarded.The trailing slash is trimmed because every consumer builds URLs as
base + "/..."(v1_oauth.go,v1_sitemaps.go,v1_users_sales_download.go,v1_users_purchases_download.go), so a trailing slash would produce//.Rebased onto current
main— the previous revision was 246 commits behind and conflicting.Test plan
go build,go vetandgofmtare clean. A standard unit test can't cover this:init()runs at package load, beforet.Setenvcould take effect. Verified instead by running the real package across the env matrix:audiusAppUrlCfg.AudiusAppUrlhttp://localhost:3000http://custom.examplehttp://custom.examplehttps://staging.audius.cohttp://custom.examplehttp://custom.examplehttps://audius.cohttps://preview.audius.cohttps://preview.audius.cohttps://trailing.example/https://trailing.exampleNote
Cfg.AudiusdURLhas the same latent bug — read fromos.Getenv("audiusdUrl")in theCfginitializer, then unconditionally overwritten in all three switch branches. Left alone as out of scope.🤖 Generated with Claude Code