renovate/lib/config/defaults.ts

27 lines
602 B
TypeScript
Raw Normal View History

2019-08-23 13:46:31 +00:00
import { RenovateConfig } from './common';
2020-05-01 16:03:48 +00:00
import { RenovateOptions, getOptions } from './definitions';
const defaultValues = {
boolean: true,
array: [],
string: null,
object: null,
};
2019-08-23 13:46:31 +00:00
export function getDefault(option: RenovateOptions): any {
2017-04-21 08:12:41 +00:00
return option.default === undefined
? defaultValues[option.type]
: option.default;
}
2019-08-23 13:46:31 +00:00
export function getConfig(): RenovateConfig {
const options = getOptions();
const config: RenovateConfig = {};
options.forEach((option) => {
if (!option.parent) {
config[option.name] = getDefault(option);
}
});
return config;
}