fix: replace hardcoded HEROKU URL with env-configurable API_BASE_URL#387
Open
swindar-zhou wants to merge 1 commit intoEAPD-DRB:mainfrom
Open
fix: replace hardcoded HEROKU URL with env-configurable API_BASE_URL#387swindar-zhou wants to merge 1 commit intoEAPD-DRB:mainfrom
swindar-zhou wants to merge 1 commit intoEAPD-DRB:mainfrom
Conversation
This was referenced Apr 1, 2026
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.
Linked issue
Existing related work reviewed
Overlap assessment
Why this PR should proceed
https://osemosys.herokuapp.com/URL in source code prevents deployment to any server other than that specific Heroku app without manual edits. This fix removes that blocker with no breaking changes for local developmentSummary
HEROKU = 0flag and hardcodedhttps://osemosys.herokuapp.com/ URL from WebAPP/Classes/Base.Class.jsapiUrl()now resolves towindow.API_BASE_URL || window.location.origin— no source code edit needed to change deployment targetAPI/Classes/Base/Config.py: addedAPI_BASE_URL = os.environ.get("API_BASE_URL", "")and madeHEROKU_DEPLOYenv-driven viaos.environ.get("HEROKU_DEPLOY", 0)API/app.py: CORS Access-Control-Allow-Origin header now usesConfig.API_BASE_URLif set, falls back tohttp://127.0.0.1; render_template passesapi_base_urltoindex.htmlWebAPP/index.html: injectswindow.API_BASE_URLfrom Flask before any scripts loadHEROKU = 1code path hardcoded a specific Heroku app URL, requiring contributors to edit source code to deploy anywhere elseAPI_BASE_URL=https://your-server.orgin the environment is sufficient — local development requires no config at all (falls back towindow.location.origin)Validation
Validation steps:
API_BASE_URL— confirm app loads and API calls resolve to window.location.originAPI_BASE_URL=https://your-server.orgin.envand restart — confirm all API calls target that URLwindow.API_BASE_URLis injected in page source via browser dev tools → View Page SourceDocumentation
Scope check
OSeMOSYS/MUIOdependencyEAPD-DRB/MUIOGO:main(not upstream)Exception rationale