Skip to content

Add typed environment configuration validation #18

Description

@Lakes41

Difficulty: Hard

Type: Maintenance

Summary

Add a typed configuration layer for API URL, chain ID, app mode, and future mobile integration settings. This avoids silently falling back to production defaults when local or release configuration is missing.

Current Behaviour

guildPassClient reads apiUrl and chainId directly from Constants.expoConfig?.extra, falling back to https://api.guildpass.xyz and chain ID 8453. Settings reads similar values directly for display.

Expected Behaviour

App configuration should be parsed and validated once, then consumed through a typed module. Invalid values should fail clearly in development and use safe release defaults only when explicitly intended.

Suggested Implementation

Create a src/config/appConfig.ts module. Validate API URL format, numeric chain ID, app environment, and optional feature flags. Update SDK client creation and settings display to use the typed config.

Files or Areas Likely Affected

  • src/lib/guildpassClient.ts
  • app/settings.tsx
  • app.json
  • .env.example
  • src/config/
  • README.md

Acceptance Criteria

  • API URL is validated before SDK client construction
  • Chain ID is parsed as a finite number
  • Settings screen reads config from a shared typed module
  • Invalid config produces a clear developer-facing error
  • .env.example documents supported values
  • README explains local and release configuration setup

Additional Notes

Assumption: the current production API fallback is useful for demos but unsafe as an implicit default in all builds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions