feat(environment): switch to a custom backend from the welcome screen - #324
Merged
Conversation
Base URL and api-key were compiled in as BuildKonfig constants, read once when the HttpClient and the websocket transport were built. They now come from an EnvironmentRepository, read per request, so the backend can be repointed without rebuilding either. Behaviour is unchanged: the repository only ever serves the build-time environment. The websocket base is derived from the http one rather than carried separately, since the two always addressed the same host. Shared fakes live in a new :core:testing module, laid out like the per-feature testing modules.
A settings entry beside the welcome actions takes a URL and an api-key, probes them, and repoints the app on success. A failed probe changes nothing; the message is shown under the field it blames. Committing a switch drops everything the previous backend owned: session, groups, queued writes, and the cached currencies and rates, which the next server has its own version of. Reachable only while signed out, so there is no live socket or in-flight sync to tear down. Web is excluded: its CSP pins connect-src to one API origin at deploy time, so a stored override could only produce blocked requests.
Nothing reads it since the websocket base became a derivation of BASE_URL_HTTP. Removing it takes the _ANDROID and _WEB overrides with it, so a local or deployed build can no longer point http and ws at different hosts by forgetting one of them. The web deploy derives its CSP ws origin the same way instead of from a second secret.
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.
No description provided.