diff --git a/constants/api.ts b/constants/api.ts index bd9dbf3..591b224 100644 --- a/constants/api.ts +++ b/constants/api.ts @@ -1,6 +1,16 @@ +const getApiBaseUrl = (): string => { + if (__DEV__) { + return process.env.EXPO_PUBLIC_API_BASE_URL || "http://192.168.1.111:8000"; + } + + return ( + process.env.EXPO_PUBLIC_API_BASE_URL || "https://football.ambigrat.com/" + ); +}; + export const API_CONFIG = { - BASE_URL: "http://192.168.1.111:8000", // Update this with your machine IP if running on device ex: http://192.168.1.5:8000 - TIMEOUT: 100000, + BASE_URL: getApiBaseUrl(), + TIMEOUT: 10000, }; export const API_ENDPOINTS = { diff --git a/eas.json b/eas.json index 276fc29..50e6b42 100644 --- a/eas.json +++ b/eas.json @@ -7,30 +7,54 @@ "development": { "developmentClient": true, "distribution": "internal", + "env": { + "EXPO_PUBLIC_API_BASE_URL": "http://192.168.1.111:8000" + }, "android": { "env": { "EAS_BUILD_DISABLE_MAVEN_CACHE": "1" } + }, + "ios": { + "env": { + "EXPO_PUBLIC_API_BASE_URL": "http://192.168.1.111:8000" + } } }, "preview": { "distribution": "internal", + "env": { + "EXPO_PUBLIC_API_BASE_URL": "https://football.ambigrat.com/" + }, "android": { "env": { "EAS_BUILD_DISABLE_MAVEN_CACHE": "1" } + }, + "ios": { + "env": { + "EXPO_PUBLIC_API_BASE_URL": "https://football.ambigrat.com/" + } } }, "production": { "autoIncrement": true, + "env": { + "EXPO_PUBLIC_API_BASE_URL": "https://football.ambigrat.com/" + }, "android": { "env": { "EAS_BUILD_DISABLE_MAVEN_CACHE": "1" } + }, + "ios": { + "env": { + "EXPO_PUBLIC_API_BASE_URL": "https://football.ambigrat.com/" + } } } }, "submit": { "production": {} } -} \ No newline at end of file +}