renovate/lib/logger/config-serializer.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

const traverse = require('traverse');
module.exports = configSerializer;
function configSerializer(config) {
const redactedFields = [
'authorization',
'token',
'githubAppKey',
'npmToken',
'npmrc',
'yarnrc',
'privateKey',
'gitPrivateKey',
'forkToken',
'password',
];
const templateFields = ['prBody'];
2018-03-08 06:22:06 +00:00
const contentFields = [
'content',
'contents',
'packageLockParsed',
'yarnLockParsed',
];
2018-05-03 12:17:45 +00:00
const arrayFields = ['packageFiles', 'upgrades'];
// eslint-disable-next-line array-callback-return
return traverse(config).map(function scrub(val) {
2018-06-04 18:44:32 +00:00
if (val && redactedFields.includes(this.key)) {
this.update('***********');
}
2018-06-04 18:44:32 +00:00
if (val && templateFields.includes(this.key)) {
this.update('[Template]');
}
2018-03-08 06:22:06 +00:00
if (val && contentFields.includes(this.key)) {
this.update('[content]');
}
2018-06-27 05:21:17 +00:00
if (val && this.key === 'releases') {
this.update(val.map(release => release.version));
}
2018-05-03 12:17:45 +00:00
// istanbul ignore if
if (val && arrayFields.includes(this.key)) {
this.update('[Array]');
}
});
}