firebase-functions 3.17.2 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cloud-functions.d.ts
CHANGED
package/lib/cloud-functions.js
CHANGED
|
@@ -252,7 +252,7 @@ function _detectAuthType(event) {
|
|
|
252
252
|
/** @hidden */
|
|
253
253
|
function optionsToTrigger(options) {
|
|
254
254
|
const trigger = {};
|
|
255
|
-
(0, encoding_1.copyIfPresent)(trigger, options, 'regions', 'schedule', 'minInstances', 'maxInstances', 'ingressSettings', 'vpcConnectorEgressSettings', 'vpcConnector', 'labels');
|
|
255
|
+
(0, encoding_1.copyIfPresent)(trigger, options, 'regions', 'schedule', 'minInstances', 'maxInstances', 'ingressSettings', 'vpcConnectorEgressSettings', 'vpcConnector', 'labels', 'secrets');
|
|
256
256
|
(0, encoding_1.convertIfPresent)(trigger, options, 'failurePolicy', 'failurePolicy', (policy) => {
|
|
257
257
|
if (policy === false) {
|
|
258
258
|
return undefined;
|
|
@@ -286,6 +286,7 @@ function optionsToEndpoint(options) {
|
|
|
286
286
|
(0, encoding_1.copyIfPresent)(endpoint, options, 'minInstances', 'maxInstances', 'ingressSettings', 'labels', 'timeoutSeconds');
|
|
287
287
|
(0, encoding_1.convertIfPresent)(endpoint, options, 'region', 'regions');
|
|
288
288
|
(0, encoding_1.convertIfPresent)(endpoint, options, 'serviceAccountEmail', 'serviceAccount', (sa) => sa);
|
|
289
|
+
(0, encoding_1.convertIfPresent)(endpoint, options, 'secretEnvironmentVariables', 'secrets', (secrets) => secrets.map((secret) => ({ secret, key: secret })));
|
|
289
290
|
if (options === null || options === void 0 ? void 0 : options.vpcConnector) {
|
|
290
291
|
endpoint.vpc = { connector: options.vpcConnector };
|
|
291
292
|
(0, encoding_1.convertIfPresent)(endpoint.vpc, options, 'egressSettings', 'vpcConnectorEgressSettings');
|
package/lib/function-builder.js
CHANGED
|
@@ -125,6 +125,13 @@ function assertRuntimeOptionsValid(runtimeOptions) {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
if (runtimeOptions.secrets !== undefined) {
|
|
129
|
+
const invalidSecrets = runtimeOptions.secrets.filter((s) => !/^[A-Za-z\d\-_]+$/.test(s));
|
|
130
|
+
if (invalidSecrets.length > 0) {
|
|
131
|
+
throw new Error(`Invalid secrets: ${invalidSecrets.join(',')}. ` +
|
|
132
|
+
'Secret must be configured using the resource id (e.g. API_KEY)');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
128
135
|
return true;
|
|
129
136
|
}
|
|
130
137
|
/**
|
|
@@ -99,6 +99,7 @@ export interface RuntimeOptions {
|
|
|
99
99
|
*/
|
|
100
100
|
invoker?: 'public' | 'private' | string | string[];
|
|
101
101
|
allowInvalidAppCheckToken?: boolean;
|
|
102
|
+
secrets?: string[];
|
|
102
103
|
}
|
|
103
104
|
export interface DeploymentOptions extends RuntimeOptions {
|
|
104
105
|
regions?: Array<typeof SUPPORTED_REGIONS[number] | string>;
|
|
@@ -18,6 +18,10 @@ export interface ManifestEndpoint {
|
|
|
18
18
|
labels?: Record<string, string>;
|
|
19
19
|
ingressSettings?: string;
|
|
20
20
|
environmentVariables?: Record<string, string>;
|
|
21
|
+
secretEnvironmentVariables?: {
|
|
22
|
+
key: string;
|
|
23
|
+
secret?: string;
|
|
24
|
+
}[];
|
|
21
25
|
httpsTrigger?: {
|
|
22
26
|
invoker?: string[];
|
|
23
27
|
};
|