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;