renovate/lib/config/defaults.js

31 lines
545 B
JavaScript
Raw Normal View History

const configDefinitions = require('./definitions');
module.exports = {
getDefault,
getConfig,
};
const defaultValues = {
boolean: true,
list: [],
string: null,
json: null,
};
function getDefault(option) {
2017-04-21 08:12:41 +00:00
return option.default === undefined
? defaultValues[option.type]
: option.default;
}
function getConfig() {
const options = configDefinitions.getOptions();
const config = {};
2017-04-21 08:12:41 +00:00
options.forEach(option => {
if (!option.parent) {
config[option.name] = getDefault(option);
}
});
return config;
}