mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
00d6249711
Now generates CLI, env and docs Makes config more testable
26 lines
577 B
JavaScript
26 lines
577 B
JavaScript
const logger = require('winston');
|
|
|
|
module.exports = {
|
|
getConfig,
|
|
isPathAbsolute,
|
|
};
|
|
|
|
function getConfig(env) {
|
|
let configFile = env.RENOVATE_CONFIG_FILE || 'config';
|
|
if (!isPathAbsolute(configFile)) {
|
|
configFile = `../../${configFile}`;
|
|
}
|
|
let config = {};
|
|
try {
|
|
// eslint-disable-next-line global-require,import/no-dynamic-require
|
|
config = require(configFile);
|
|
} catch (err) {
|
|
// Do nothing
|
|
logger.verbose('Could not locate config file');
|
|
}
|
|
return config;
|
|
}
|
|
|
|
function isPathAbsolute(path) {
|
|
return /^(?:\/|[a-z]+:\/\/)/.test(path);
|
|
}
|