@camunda8/sdk
Version:
[](https://www.npmjs.com/package/@camunda8/sdk)
38 lines • 1.29 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentSetup = void 0;
const debug_1 = __importDefault(require("debug"));
const _1 = require(".");
const trace = (0, debug_1.default)('test:config');
const storage = {};
function wipeEnv() {
_1.CamundaEnvironmentVariableDictionary.forEach((key) => {
trace('wiping', key, process.env[key]);
delete process.env[key];
});
trace('Environment wiped');
}
/** Store all env vars, then wipe them in the environment */
function storeEnv() {
_1.CamundaEnvironmentVariableDictionary.forEach((key) => {
storage[key] = process.env[key];
trace('storing', key, process.env[key]);
});
trace('storage', storage);
return storage;
}
/** Restore all env vars, and wipe storage */
function restoreEnv(storage) {
_1.CamundaEnvironmentVariableDictionary.forEach((key) => (process.env[key] = storage[key]));
trace('restoring', storage);
Object.keys(storage).forEach((key) => delete storage[key]);
}
exports.EnvironmentSetup = {
wipeEnv,
storeEnv,
restoreEnv,
};
//# sourceMappingURL=EnvironmentSetup.js.map