File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
quickstarts/runtime-options/functions Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,20 @@ exports.getAutocompleteResponse = functions
11
11
} ) ;
12
12
// [END runtimeMinInstances]
13
13
14
+ // [START runtimeMinInstancesDynamic]
15
+ // Get Firebase project id from `FIREBASE_CONFIG` environment variable
16
+ const envProjectId = JSON . parse ( process . env . FIREBASE_CONFIG ) . projectId ;
17
+
18
+ exports . renderProfilePage = functions
19
+ . runWith ( {
20
+ // Keep 5 instances warm for this latency-critical function
21
+ // in production only. Default to 0 for test projects.
22
+ minInstances : envProjectId === "my-production-project" ? 5 : 0 ,
23
+ } )
24
+ . https . onRequest ( ( req , res ) => {
25
+ // render some html
26
+ } ) ;
27
+ // [END runtimeMinInstancesDynamic]
14
28
15
29
// [START runtimeMaxInstances]
16
30
exports . mirrorOrdersToLegacyDatabase = functions
You can’t perform that action at this time.
0 commit comments