diff --git a/src/main.ts b/src/main.ts index a2e621d..d528202 100644 --- a/src/main.ts +++ b/src/main.ts @@ -57,7 +57,7 @@ export { } from './v1'; // V2 Exports -export { WrappedV2Function } from './v2'; +export { WrappedV2Function, mockSecretManager } from './v2'; export function wrap( cloudFunction: HttpsFunction & Runnable diff --git a/src/v2.ts b/src/v2.ts index e3fef18..2902aac 100644 --- a/src/v2.ts +++ b/src/v2.ts @@ -93,3 +93,10 @@ export function wrapV2>( return cloudFunction.run(cloudEvent); }; } + +/** Mock values returned by `functions.config()`. */ +export function mockSecretManager(conf: { [key: string]: any }) { + for (const [key, value] of Object.entries(conf)) { + process.env[key] = value; + } +}