fix(mobile): unify mobile environment configuration into a single module (#557) - #626
Closed
ZacLou wants to merge 1 commit into
Closed
fix(mobile): unify mobile environment configuration into a single module (#557)#626ZacLou wants to merge 1 commit into
ZacLou wants to merge 1 commit into
Conversation
…LitCodes#557) - services/api.ts now imports apiUrl from security/env.ts instead of reading EXPO_PUBLIC_API_BASE_URL directly - EXPO_PUBLIC_API_BASE_URL is fully removed from the codebase - security/env.ts: corrected dev rpcUrl default from 8545 (EVM port) to 8000 (Soroban RPC port) - validateEnv() now provides detailed warnings in development when env vars are missing or still using defaults - validateEnv() is called at app start in app/_layout.tsx - Added apps/mobile/.env.example documenting EXPO_PUBLIC_APP_ENV, EXPO_PUBLIC_API_URL, and EXPO_PUBLIC_RPC_URL Closes StayLitCodes#557
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.
Overview
Fixes #557 — unifies the mobile environment configuration so
security/env.tsis the single source of truth. Previously,services/api.tsreadEXPO_PUBLIC_API_BASE_URLwhilesecurity/env.tsreadEXPO_PUBLIC_API_URL— two variables for the same thing with different defaults, causing silent fallbacks.Changes
apps/mobile/services/api.tsenvConfigfrom../security/envand usesenvConfig.apiUrlas the API base URLEXPO_PUBLIC_API_BASE_URLis fully removed — no longer referenced anywhere in the mobile codebaseapps/mobile/security/env.tsrpcUrldefault fromhttp://127.0.0.1:8545(EVM port) tohttp://127.0.0.1:8000(Soroban RPC port)validateEnv()to provide detailed warnings when:apps/mobile/app/_layout.tsxvalidateEnv()at module load (beforeRootLayout) so warnings appear at app startapps/mobile/.env.example(new)EXPO_PUBLIC_APP_ENV,EXPO_PUBLIC_API_URL, andEXPO_PUBLIC_RPC_URLAcceptance Criteria Checklist
services/api.tsbuilds its axios instance fromenvConfig.apiUrlEXPO_PUBLIC_API_BASE_URLis removed from the codebase.env.exampleinapps/mobiledocumentsEXPO_PUBLIC_APP_ENV,EXPO_PUBLIC_API_URL, andEXPO_PUBLIC_RPC_URLvalidateEnv()is called at app start and surfaces a visible warning in development when config is missingrpcUrldev default (http://127.0.0.1:8545, an EVM-style port) is corrected to a Soroban RPC endpointCloses #557