import Constants from "expo-constants"; // Expo-side equivalent of desktop's __APP_ENV__ build-time replacement // (see js/desktop/src/config/env.ts). On mobile we read from app.config.ts // `extra.appEnv`, which itself reads `process.env.EXPO_PUBLIC_APP_ENV` at // build time. Defaults to "dev". // // Firebase web config is public by design (security is enforced via // Firestore rules + App Check), so both configs live in source. To refresh, // run: cd infra/gcp/{dev,prod} && terraform output -json firebase_config type FirebaseConfig = { apiKey: string; appId: string; authDomain: string; messagingSenderId: string; projectId: string; storageBucket: string; }; type AppConfig = { orionUrl: string; pusherUrl: string; firebase: FirebaseConfig; /** Empty string disables Sentry. Same DSN across envs; events are split by `environment` tag. */ sentryDsn: string; }; const configs: Record<"dev" | "prod", AppConfig> = { dev: { orionUrl: "https://orion.dev.flowy.live", pusherUrl: "wss://pusher.dev.flowy.live/ws", firebase: { apiKey: "AIzaSyDF_fbk7tDY9tNxUiOwwi--2nYZWZygMGk", appId: "1:1006580076785:web:e2a0736d60a78e02b15950", authDomain: "flowy-dev-440017.firebaseapp.com", messagingSenderId: "1006580076785", projectId: "flowy-dev-440017", storageBucket: "flowy-dev-440017.firebasestorage.app", }, sentryDsn: "https://4bb3af832825929eeec8ab4edd56930f@o4511282312118272.ingest.us.sentry.io/4511282313494528", }, prod: { orionUrl: "https://orion.flowy.live", pusherUrl: "wss://pusher.flowy.live/ws", firebase: { apiKey: "AIzaSyB8it3SKr9DHScHGlpu4uwWicvt8wzjdBg", appId: "1:68063426854:web:5054f16f50898f5706e9e7", authDomain: "flowy-prod-440017.firebaseapp.com", messagingSenderId: "68063426854", projectId: "flowy-prod-440017", storageBucket: "flowy-prod-440017.firebasestorage.app", }, sentryDsn: "https://4bb3af832825929eeec8ab4edd56930f@o4511282312118272.ingest.us.sentry.io/4511282313494528", }, }; const rawEnv = (Constants.expoConfig?.extra as { appEnv?: string } | undefined) ?.appEnv; export const appEnv: "dev" | "prod" = rawEnv === "prod" ? "prod" : "dev"; export const appConfig: AppConfig = configs[appEnv];