renovate/lib/config/file.js
Rhys Arkins 9a93c8e99a feat: postUpdateOptions
Adds new config option postUpateOptions. Currently supports one value - gomodTidy.
2019-03-07 15:15:01 +01:00

31 lines
832 B
JavaScript

const path = require('path');
const { migrateConfig } = require('./migration');
module.exports = {
getConfig,
};
function getConfig(env) {
let configFile = env.RENOVATE_CONFIG_FILE || 'config';
if (!path.isAbsolute(configFile)) {
configFile = `${process.cwd()}/${configFile}`;
logger.debug('Checking for config file in ' + configFile);
}
let config = {};
try {
// eslint-disable-next-line global-require,import/no-dynamic-require
config = require(configFile);
} catch (err) {
// Do nothing
logger.debug('No config file found on disk - skipping');
}
const { isMigrated, migratedConfig } = migrateConfig(config);
if (isMigrated) {
logger.warn(
{ originalConfig: config, migratedConfig },
'Config needs migrating'
);
config = migratedConfig;
}
return config;
}