From fcf9e70d54bd737d2dea848d25314120f37db503 Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 18 Jan 2026 02:58:27 +0000 Subject: [WIP] Heartbeat checkpoint - 2026-01-18 02:58:27 UTC --- apps/mobile/lib/config.ts | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 apps/mobile/lib/config.ts (limited to 'apps/mobile/lib/config.ts') 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; -- cgit v1.2.3