UNPKG

@camunda8/sdk

Version:

[![NPM](https://nodei.co/npm/@camunda8/sdk.png)](https://www.npmjs.com/package/@camunda8/sdk)

35 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EnvironmentSetup = void 0; const _1 = require("."); const storage = {}; let envStored = false; function wipeEnv() { if (!envStored) { throw new Error('Environment not stored. Refusing to wipe.'); } _1.CamundaEnvironmentVariableDictionary.forEach((key) => delete process.env[key]); } /** Store all env vars, then wipe them in the environment */ function storeEnv() { if (envStored) { throw new Error('Environment already stored. Refusing to store again.'); } _1.CamundaEnvironmentVariableDictionary.forEach((key) => (storage[key] = process.env[key])); envStored = true; } /** Restore all env vars, and wipe storage */ function restoreEnv() { if (!envStored) { throw new Error('Environment not stored. Refusing to restore.'); } _1.CamundaEnvironmentVariableDictionary.forEach((key) => (process.env[key] = storage[key])); Object.keys(storage).forEach((key) => delete storage[key]); envStored = false; } exports.EnvironmentSetup = { wipeEnv, storeEnv, restoreEnv, }; //# sourceMappingURL=EnvironmentSetup.js.map