(keyValues, globalConfigPath = defaultConfigPath)
| 68251 | globalPath = defaultConfigPath |
| 68252 | } = {}) => { |
| 68253 | const envConfig = getEnvConfig(envPath); |
| 68254 | const globalConfig = getGlobalConfig(globalPath); |
| 68255 | const config8 = mergeConfigs(envConfig, globalConfig); |
| 68256 | const cleanConfig = cleanUndefinedValues(config8); |
| 68257 | return cleanConfig; |
| 68258 | }; |
| 68259 | var setConfig = (keyValues, globalConfigPath = defaultConfigPath) => { |
| 68260 | const config8 = getConfig({ |
| 68261 | globalPath: globalConfigPath |
| 68262 | }); |
| 68263 | const configToSet = {}; |
| 68264 | for (let [key, value] of keyValues) { |
| 68265 | if (!configValidators.hasOwnProperty(key)) { |
| 68266 | const supportedKeys = Object.keys(configValidators).join("\n"); |
| 68267 | throw new Error( |
| 68268 | `Unsupported config key: ${key}. Expected keys are: |
| 68269 | |
| 68270 | ${supportedKeys}. |
| 68271 | |
| 68272 | For more help refer to our docs: https://github.com/di-sukharev/opencommit` |
| 68273 | ); |
| 68274 | } |
| 68275 | let parsedConfigValue; |
| 68276 | try { |
| 68277 | if (typeof value === "string") parsedConfigValue = JSON.parse(value); |
| 68278 | else parsedConfigValue = value; |
| 68279 | } catch (error) { |
| 68280 | parsedConfigValue = value; |
| 68281 | } |
| 68282 | const validValue = configValidators[key]( |
| 68283 | parsedConfigValue, |
| 68284 | config8 |
| 68285 | ); |
| 68286 | configToSet[key] = validValue; |
| 68287 | } |
no test coverage detected
searching dependent graphs…