Skip to content

fix(mobile): unify mobile environment configuration into a single module (#557) - #626

Closed
ZacLou wants to merge 1 commit into
StayLitCodes:mainfrom
ZacLou:fix/unify-mobile-env-config
Closed

fix(mobile): unify mobile environment configuration into a single module (#557)#626
ZacLou wants to merge 1 commit into
StayLitCodes:mainfrom
ZacLou:fix/unify-mobile-env-config

Conversation

@ZacLou

@ZacLou ZacLou commented Aug 29, 2026

Copy link
Copy Markdown

Overview

Fixes #557 — unifies the mobile environment configuration so security/env.ts is the single source of truth. Previously, services/api.ts read EXPO_PUBLIC_API_BASE_URL while security/env.ts read EXPO_PUBLIC_API_URL — two variables for the same thing with different defaults, causing silent fallbacks.

Changes

apps/mobile/services/api.ts

  • Now imports envConfig from ../security/env and uses envConfig.apiUrl as the API base URL
  • EXPO_PUBLIC_API_BASE_URL is fully removed — no longer referenced anywhere in the mobile codebase

apps/mobile/security/env.ts

  • Corrected the dev rpcUrl default from http://127.0.0.1:8545 (EVM port) to http://127.0.0.1:8000 (Soroban RPC port)
  • Enhanced validateEnv() to provide detailed warnings when:
    • Required vars are not set
    • Dev config is still using default localhost URLs (prompts developer to set explicitly)

apps/mobile/app/_layout.tsx

  • Calls validateEnv() at module load (before RootLayout) so warnings appear at app start

apps/mobile/.env.example (new)

  • Documents EXPO_PUBLIC_APP_ENV, EXPO_PUBLIC_API_URL, and EXPO_PUBLIC_RPC_URL
  • Includes per-environment guidance (dev/testnet/production)

Acceptance Criteria Checklist

  • services/api.ts builds its axios instance from envConfig.apiUrl
  • EXPO_PUBLIC_API_BASE_URL is removed from the codebase
  • A .env.example in apps/mobile documents EXPO_PUBLIC_APP_ENV, EXPO_PUBLIC_API_URL, and EXPO_PUBLIC_RPC_URL
  • validateEnv() is called at app start and surfaces a visible warning in development when config is missing
  • The rpcUrl dev default (http://127.0.0.1:8545, an EVM-style port) is corrected to a Soroban RPC endpoint

Closes #557

…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
@Cedarich Cedarich closed this Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MOBILE] Unify mobile environment configuration into a single module

2 participants