MCPcopy
hub / github.com/di-sukharev/opencommit / setConfig

Function setConfig

out/cli.cjs:68253–68284  ·  view source on GitHub ↗
(keyValues, globalConfigPath = defaultConfigPath)

Source from the content-addressed store, hash-verified

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};
68259var 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
68272For 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 }

Callers 3

cli.cjsFile · 0.70
setDefaultConfigValuesFunction · 0.70

Calls 5

getConfigFunction · 0.70
setGlobalConfigFunction · 0.70
mergeConfigsFunction · 0.70
keysMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…