diff options
| author | soryu <soryu@soryu.co> | 2026-01-18 02:58:27 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-18 02:58:27 +0000 |
| commit | fcf9e70d54bd737d2dea848d25314120f37db503 (patch) | |
| tree | bc304a9e153485f7686830614b2ddae4d4ff182e /apps/mobile/lib/config.ts | |
| parent | f84a7f2d820f6f432be2b1d78d6bf833b5b19380 (diff) | |
| download | soryu-fcf9e70d54bd737d2dea848d25314120f37db503.tar.gz soryu-fcf9e70d54bd737d2dea848d25314120f37db503.zip | |
[WIP] Heartbeat checkpoint - 2026-01-18 02:58:27 UTC
Diffstat (limited to 'apps/mobile/lib/config.ts')
| -rw-r--r-- | apps/mobile/lib/config.ts | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/apps/mobile/lib/config.ts b/apps/mobile/lib/config.ts new file mode 100644 index 0000000..70fce52 --- /dev/null +++ b/apps/mobile/lib/config.ts @@ -0,0 +1,89 @@ +import { Platform } from 'react-native'; + +/** + * API configuration for Makima mobile app + * Supports different environments and platforms + */ + +// Environment detection +const isDevelopment = __DEV__; + +/** + * API base URLs for different environments + */ +export const API_CONFIG = { + local: 'http://localhost:8080', + // Use 10.0.2.2 for Android emulator to access host machine's localhost + localAndroid: 'http://10.0.2.2:8080', + production: 'https://api.makima.jp', +} as const; + +/** + * Get the appropriate API base URL based on environment and platform + */ +export function getApiBaseUrl(): string { + // Check for environment variable override + const envUrl = process.env.EXPO_PUBLIC_API_URL; + if (envUrl) { + return envUrl; + } + + // In production, use the production API + if (!isDevelopment) { + return API_CONFIG.production; + } + + // In development, use local API with platform-specific URL + if (Platform.OS === 'android') { + return API_CONFIG.localAndroid; + } + + return API_CONFIG.local; +} + +/** + * App configuration object + */ +export const config = { + /** + * API base URL for making requests + */ + apiBaseUrl: getApiBaseUrl(), + + /** + * Whether the app is running in development mode + */ + isDevelopment, + + /** + * Supabase URL (from environment or default) + */ + supabaseUrl: process.env.EXPO_PUBLIC_SUPABASE_URL || 'https://ynxyjytytmfwxjqxljzm.supabase.co', + + /** + * App version + */ + version: '1.0.0', + + /** + * Support/help URL + */ + supportUrl: 'https://makima.jp/support', + + /** + * Privacy policy URL + */ + privacyPolicyUrl: 'https://makima.jp/privacy', + + /** + * Terms of service URL + */ + termsOfServiceUrl: 'https://makima.jp/terms', + + /** + * Forgot password URL (opens in browser) + */ + forgotPasswordUrl: 'https://makima.jp/forgot-password', +} as const; + +export type Config = typeof config; |
