From b0a0ee241124cca869174e09d6ced2ae8094277d Mon Sep 17 00:00:00 2001 From: Alex <18004529+A13k2@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:49:58 +0000 Subject: [PATCH] feat: release v2 mock secret manager --- src/main.ts | 2 +- src/v2.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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; + } +}