UNPKG

@creditkarma/dynamic-config

Version:

Dynamic Config for Node.js backed by Consul and Vault

33 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.envResolver = void 0; const errors_1 = require("../errors"); const utils_1 = require("../utils"); function envResolver() { return { type: 'remote', name: 'env', async init(configInstance, remoteOptions = {}) { return {}; }, async get(key, type) { const value = process.env[key]; if (value !== undefined) { if (type !== undefined) { return utils_1.ConfigUtils.readValueForType(key, value, type); } else { return Promise.resolve(value); } } else { throw new errors_1.MissingEnvironmentVariable(key); } }, watch(key, cb, type) { // Nothing to do. Can't watch environment variables. }, }; } exports.envResolver = envResolver; //# sourceMappingURL=env.js.map