Skip to content

Commit

Permalink
refactor: host-rules ruleMatch -> resolvedHost
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed May 1, 2021
1 parent 2a9f894 commit 5246e6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/util/host-rules.ts
Expand Up @@ -16,14 +16,13 @@ export function add(params: HostRule): void {
if (params.hostName && params.baseUrl) {
throw new Error('hostRules cannot contain both a hostName and baseUrl');
}
hostRules.push(params);
const confidentialFields = ['password', 'token'];
const ruleMatch = params.baseUrl || params.hostName || params.domainName;
if (ruleMatch) {
const resolvedHost = params.baseUrl || params.hostName || params.domainName;
if (resolvedHost) {
confidentialFields.forEach((field) => {
if (params[field]) {
logger.debug(
`Adding ${field} authentication for ${ruleMatch} to hostRules`
`Adding ${field} authentication for ${resolvedHost} to hostRules`
);
}
});
Expand All @@ -40,6 +39,7 @@ export function add(params: HostRule): void {
).toString('base64');
sanitize.add(secret);
}
hostRules.push(params);
}

export interface HostRuleSearch {
Expand Down

0 comments on commit 5246e6b

Please sign in to comment.