/** * AWOOOI Frontend Configuration * ============================== * 專案鐵律: 禁止任何 Fallback IP * * 唯一真相來源 - 所有 API URL 必須從環境變數取得 * 環境變數缺失即噴錯,絕不姑息 */ /** * 取得 API Base URL (絕對純化版) * * @throws Error 如果 NEXT_PUBLIC_API_URL 未設定 */ function requireApiUrl(): string { const url = process.env.NEXT_PUBLIC_API_URL if (!url) { const errorMsg = '[AWOOOI ERROR] Missing API URL configuration. Set NEXT_PUBLIC_API_URL in .env.local' console.error(errorMsg) throw new Error(errorMsg) } return url } /** * API Base URL (環境變數必填) */ export const API_BASE_URL = requireApiUrl() /** * API Base URL with /api/v1 prefix */ export const API_V1_URL = `${API_BASE_URL}/api/v1` /** * Get API URL (for dynamic usage) * @throws Error 如果環境變數未設定 */ export function getApiUrl(): string { return requireApiUrl() }