BangSo/apps/mobile/app.config.ts

25 lines
720 B
TypeScript
Raw Permalink Normal View History

2026-09-01 16:51:19 +00:00
import type { ConfigContext, ExpoConfig } from "expo/config";
export default ({ config }: ConfigContext): ExpoConfig => {
if (process.env.EAS_BUILD_PROFILE === "production") {
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
if (!apiUrl) {
throw new Error(
"EXPO_PUBLIC_API_URL must be set in the EAS production environment before building for the App Store.",
);
}
let parsed: URL;
try {
parsed = new URL(apiUrl);
} catch {
throw new Error("EXPO_PUBLIC_API_URL must be a valid URL.");
}
if (parsed.protocol !== "https:") {
throw new Error("EXPO_PUBLIC_API_URL must use HTTPS for production builds.");
}
}
return config as ExpoConfig;
};