mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
9a93c8e99a
Adds new config option postUpateOptions. Currently supports one value - gomodTidy.
31 lines
832 B
JavaScript
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;
|
|
}
|