Cloud Environment Strategy (Xcode + Cognito Placeholders)
Last updated: 2026-04-06
This document defines the app-side environment strategy for cloud auth and API routing.
Goals
- Keep one codebase for development and customer cutovers.
- Avoid committing secrets.
- Make environment selection explicit and reproducible in Xcode.
- Support local developer overrides without changing committed files.
Configuration Layers
Info.plistbuild-setting substitutions (non-secret defaults).xcconfigfiles for baseline values.- Xcode scheme environment variables for per-scheme overrides.
Runtime precedence is:
- Process environment variables (scheme/env injection).
Info.plistvalues.
Files
- Build config defaults:
Config/Build/Base.xcconfigConfig/Build/Debug.xcconfigConfig/Build/Release.xcconfig- Environment defaults:
Config/Environments/CC-DEV.xcconfig- Shared dev scheme:
BionicLoop.xcodeproj/xcshareddata/xcschemes/CC-DEV.xcscheme
Debug.xcconfig currently includes CC-DEV.xcconfig as the default dev baseline.
Release.xcconfig also currently includes CC-DEV.xcconfig so TestFlight archives resolve a real Cognito/API configuration instead of placeholder values.
Temporary policy note:
- this
Release -> CC-DEVmapping is a placeholder only, - it exists so current TestFlight builds can exercise the authenticated workflow,
- it should be replaced with a dedicated staging and/or production environment mapping as soon as those AWS environments are available.
Note: URL values in .xcconfig files use :/$()/ to avoid // being parsed as a comment.
Info.plist Keys
These keys are substituted at build time and read at runtime:
BLAuthEnvironmentNameBLAPIBaseURLBLCognitoUserPoolIDBLCognitoUserPoolClientIDBLCognitoHostedUIDomainBLCognitoSignInRedirectURIBLCognitoSignOutRedirectURI
Runtime Loader
AuthEnvironment (in BionicLoop/App/ContentView.swift) resolves:
- environment variable override keys:
BL_AUTH_ENV_NAMEBL_API_BASE_URLBL_COGNITO_USER_POOL_IDBL_COGNITO_USER_POOL_CLIENT_IDBL_COGNITO_HOSTED_UI_DOMAINBL_COGNITO_SIGN_IN_REDIRECT_URIBL_COGNITO_SIGN_OUT_REDIRECT_URI- fallback to the corresponding
Info.plistkeys.
The loader exposes isConfigured so placeholder values are easy to detect.
Creating a Customer Environment
- Add
Config/Environments/<CUSTOMER>.xcconfigwith non-secret defaults. - Decide default policy:
- include that file in
Config/Build/Debug.xcconfig, or - keep
Debug.xcconfiggeneric and set scheme env overrides only. - Decide Release/TestFlight policy separately:
- either map
Config/Build/Release.xcconfigto the intended environment, or - create a dedicated release-style config such as
Release-<CUSTOMER>.xcconfigfor archive/TestFlight use. - Duplicate
CC-DEV.xcschemeto<CUSTOMER>-DEV.xcscheme. - Set
<CUSTOMER>-DEVscheme environment variables to the new AWS values for local runs as needed. - Validate:
- app launch logs
[AuthEnvironment] ... - auth flow uses expected domain/user-pool config.
Important:
- scheme environment variables help local Xcode runs,
- archived/TestFlight apps depend on the values resolved into
Info.plistby build settings, - do not rely on scheme-only overrides for TestFlight.
Secret Handling
- Do not store client secrets in app config.
- Keep credentials/tokens in CI secret stores or AWS secret systems.
- Keep committed config values non-secret and auditable.