From 5246e6b34e8132419ba0ea5bc14ce9fd5321c3ba Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 1 May 2021 13:07:46 +0200
Subject: [PATCH] refactor: host-rules ruleMatch -> resolvedHost

---
 lib/util/host-rules.ts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/util/host-rules.ts b/lib/util/host-rules.ts
index 542286f7da..111ccd47f3 100644
--- a/lib/util/host-rules.ts
+++ b/lib/util/host-rules.ts
@@ -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`
         );
       }
     });
@@ -40,6 +39,7 @@ export function add(params: HostRule): void {
     ).toString('base64');
     sanitize.add(secret);
   }
+  hostRules.push(params);
 }
 
 export interface HostRuleSearch {
-- 
GitLab