@@ -10,9 +10,10 @@ import {
10
10
} from "../../extensions/extensionsHelper" ;
11
11
import { logger } from "../../logger" ;
12
12
import { readInstanceParam } from "../../extensions/manifest" ;
13
- import { ParamBindingOptions } from "../../extensions/paramHelper" ;
13
+ import { isSystemParam , ParamBindingOptions } from "../../extensions/paramHelper" ;
14
14
import { readExtensionYaml , readPostinstall } from "../../extensions/emulator/specHelper" ;
15
15
import { ExtensionVersion , Extension , ExtensionSpec } from "../../extensions/types" ;
16
+ import { partitionRecord } from "../../functional" ;
16
17
17
18
export interface InstanceSpec {
18
19
instanceId : string ;
@@ -46,6 +47,7 @@ export interface ManifestInstanceSpec extends InstanceSpec {
46
47
*/
47
48
export interface DeploymentInstanceSpec extends InstanceSpec {
48
49
params : Record < string , string > ;
50
+ systemParams : Record < string , string > ;
49
51
allowedEventTypes ?: string [ ] ;
50
52
eventarcChannel ?: string ;
51
53
etag ?: string ;
@@ -107,6 +109,7 @@ export async function have(projectId: string): Promise<DeploymentInstanceSpec[]>
107
109
const dep : DeploymentInstanceSpec = {
108
110
instanceId : i . name . split ( "/" ) . pop ( ) ! ,
109
111
params : i . config . params ,
112
+ systemParams : i . config . systemParams ?? { } ,
110
113
allowedEventTypes : i . config . allowedEventTypes ,
111
114
eventarcChannel : i . config . eventarcChannel ,
112
115
etag : i . etag ,
@@ -145,7 +148,7 @@ export async function want(args: {
145
148
try {
146
149
const instanceId = e [ 0 ] ;
147
150
148
- const params = readInstanceParam ( {
151
+ const rawParams = readInstanceParam ( {
149
152
projectDir : args . projectDir ,
150
153
instanceId,
151
154
projectId : args . projectId ,
@@ -154,26 +157,28 @@ export async function want(args: {
154
157
checkLocal : args . emulatorMode ,
155
158
} ) ;
156
159
const autoPopulatedParams = await getFirebaseProjectParams ( args . projectId , args . emulatorMode ) ;
157
- const subbedParams = substituteParams ( params , autoPopulatedParams ) ;
160
+ const subbedParams = substituteParams ( rawParams , autoPopulatedParams ) ;
161
+ const [ systemParams , params ] = partitionRecord ( subbedParams , isSystemParam ) ;
158
162
159
163
// ALLOWED_EVENT_TYPES can be undefined (user input not provided) or empty string (no events selected).
160
164
// If empty string, we want to pass an empty array. If it's undefined we want to pass through undefined.
161
165
const allowedEventTypes =
162
- subbedParams . ALLOWED_EVENT_TYPES !== undefined
163
- ? subbedParams . ALLOWED_EVENT_TYPES . split ( "," ) . filter ( ( e ) => e !== "" )
166
+ params . ALLOWED_EVENT_TYPES !== undefined
167
+ ? params . ALLOWED_EVENT_TYPES . split ( "," ) . filter ( ( e ) => e !== "" )
164
168
: undefined ;
165
- const eventarcChannel = subbedParams . EVENTARC_CHANNEL ;
169
+ const eventarcChannel = params . EVENTARC_CHANNEL ;
166
170
167
171
// Remove special params that are stored in the .env file but aren't actually params specified by the publisher.
168
172
// Currently, only environment variables needed for Events features are considered special params stored in .env files.
169
- delete subbedParams [ "EVENTARC_CHANNEL" ] ;
170
- delete subbedParams [ "ALLOWED_EVENT_TYPES" ] ;
173
+ delete params [ "EVENTARC_CHANNEL" ] ;
174
+ delete params [ "ALLOWED_EVENT_TYPES" ] ;
171
175
172
176
if ( isLocalPath ( e [ 1 ] ) ) {
173
177
instanceSpecs . push ( {
174
178
instanceId,
175
179
localPath : e [ 1 ] ,
176
- params : subbedParams ,
180
+ params,
181
+ systemParams,
177
182
allowedEventTypes : allowedEventTypes ,
178
183
eventarcChannel : eventarcChannel ,
179
184
} ) ;
@@ -183,7 +188,8 @@ export async function want(args: {
183
188
instanceSpecs . push ( {
184
189
instanceId,
185
190
ref,
186
- params : subbedParams ,
191
+ params,
192
+ systemParams,
187
193
allowedEventTypes : allowedEventTypes ,
188
194
eventarcChannel : eventarcChannel ,
189
195
} ) ;
0 commit comments