File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// setup server and app options from Functions config (and mocks)
2- const { GCP_PROJECT , GCLOUD_PROJECT } = process . env
3- const projectId = GCP_PROJECT || GCLOUD_PROJECT
2+ const { GCLOUD_PROJECT , FIREBASE_CONFIG , FUNCTION_REGION } = process . env
43const { pkg, server } = require ( 'firebase-functions' ) . config ( )
4+
5+ let projectId = GCLOUD_PROJECT
6+ if ( FIREBASE_CONFIG ) {
7+ projectId = JSON . parse ( FIREBASE_CONFIG ) . projectId
8+ }
9+ const region = FUNCTION_REGION || 'us-central1'
510const functionName = server . functionName || 'app'
611
712module . exports = {
813 functionName,
914 operatorToken : server && server . operator_token ,
1015 baseUri : ( server && server . base_uri ) ||
11- `https://us-central1 -${ projectId } .cloudfunctions.net/${ functionName } ` ,
16+ `https://${ region } -${ projectId } .cloudfunctions.net/${ functionName } ` ,
1217 hostingUri : `https://${ projectId } .web.app` ,
1318 pkg : {
1419 ...pkg
You can’t perform that action at this time.
0 commit comments