Point v2 functions @ localhost during emulation (#597)

This commit is contained in:
Marshall Polaris 2022-06-29 16:31:53 -07:00 committed by GitHub
parent 7bbc425690
commit 2fbbc66029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,8 +41,13 @@ export async function call(url: string, method: string, params: any) {
// one less hop // one less hop
export function getFunctionUrl(name: string) { export function getFunctionUrl(name: string) {
if (process.env.NEXT_PUBLIC_FIREBASE_EMULATE) {
const { projectId, region } = ENV_CONFIG.firebaseConfig
return `http://localhost:5001/${projectId}/${region}/${name}`
} else {
const { cloudRunId, cloudRunRegion } = ENV_CONFIG const { cloudRunId, cloudRunRegion } = ENV_CONFIG
return `https://${name}-${cloudRunId}-${cloudRunRegion}.a.run.app` return `https://${name}-${cloudRunId}-${cloudRunRegion}.a.run.app`
}
} }
export function createMarket(params: any) { export function createMarket(params: any) {