From 8c78b5a733b83131d762c64c58ae8ddbeed4d9a3 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Tue, 28 Nov 2023 23:31:18 +0100
Subject: [PATCH] fix(keep-alive): use camlcase for option name (#26018)

---
 docs/usage/configuration-options.md           | 2 +-
 lib/config/migrations/migrations-service.ts   | 1 +
 lib/config/options/index.ts                   | 4 ++--
 lib/types/host-rules.ts                       | 2 +-
 lib/util/http/host-rules.spec.ts              | 4 ++--
 lib/util/http/host-rules.ts                   | 6 +++---
 lib/util/http/{keepalive.ts => keep-alive.ts} | 4 ++--
 7 files changed, 12 insertions(+), 11 deletions(-)
 rename lib/util/http/{keepalive.ts => keep-alive.ts} (73%)

diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md
index b87b2fcc92..2370bc70cc 100644
--- a/docs/usage/configuration-options.md
+++ b/docs/usage/configuration-options.md
@@ -1796,7 +1796,7 @@ Example:
 }
 ```
 
-### keepalive
+### keepAlive
 
 If enabled, this allows a single TCP connection to remain open for multiple HTTP(S) requests/responses.
 
diff --git a/lib/config/migrations/migrations-service.ts b/lib/config/migrations/migrations-service.ts
index 80c473844d..1f6023a27a 100644
--- a/lib/config/migrations/migrations-service.ts
+++ b/lib/config/migrations/migrations-service.ts
@@ -84,6 +84,7 @@ export class MigrationsService {
     ['endpoints', 'hostRules'],
     ['excludedPackageNames', 'excludePackageNames'],
     ['exposeEnv', 'exposeAllEnv'],
+    ['keepalive', 'keepAlive'],
     ['managerBranchPrefix', 'additionalBranchPrefix'],
     ['multipleMajorPrs', 'separateMultipleMajor'],
     ['separatePatchReleases', 'separateMinorPatch'],
diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts
index a3d0eed47e..f452d97359 100644
--- a/lib/config/options/index.ts
+++ b/lib/config/options/index.ts
@@ -2349,8 +2349,8 @@ const options: RenovateOptions[] = [
     experimental: true,
   },
   {
-    name: 'keepalive',
-    description: 'Enable HTTP keepalives for hosts.',
+    name: 'keepAlive',
+    description: 'Enable HTTP keep-alive for hosts.',
     type: 'boolean',
     stage: 'repository',
     parent: 'hostRules',
diff --git a/lib/types/host-rules.ts b/lib/types/host-rules.ts
index 058ed21e1e..c8b26a1358 100644
--- a/lib/types/host-rules.ts
+++ b/lib/types/host-rules.ts
@@ -13,7 +13,7 @@ export interface HostRuleSearchResult {
   maxRequestsPerSecond?: number;
 
   dnsCache?: boolean;
-  keepalive?: boolean;
+  keepAlive?: boolean;
   artifactAuth?: string[] | null;
   httpsCertificateAuthority?: string;
   httpsPrivateKey?: string;
diff --git a/lib/util/http/host-rules.spec.ts b/lib/util/http/host-rules.spec.ts
index adb46f9e4b..11c215d5ed 100644
--- a/lib/util/http/host-rules.spec.ts
+++ b/lib/util/http/host-rules.spec.ts
@@ -115,8 +115,8 @@ describe('util/http/host-rules', () => {
     });
   });
 
-  it('uses http keepalives', () => {
-    hostRules.add({ keepalive: true });
+  it('uses http keep-alive', () => {
+    hostRules.add({ keepAlive: true });
     expect(
       applyHostRules(url, { ...options, token: 'xxx' }).agent,
     ).toBeDefined();
diff --git a/lib/util/http/host-rules.ts b/lib/util/http/host-rules.ts
index 7f5b52c293..d0346584f0 100644
--- a/lib/util/http/host-rules.ts
+++ b/lib/util/http/host-rules.ts
@@ -11,7 +11,7 @@ import type { HostRule } from '../../types';
 import * as hostRules from '../host-rules';
 import { parseUrl } from '../url';
 import { dnsLookup } from './dns';
-import { keepaliveAgents } from './keepalive';
+import { keepAliveAgents } from './keep-alive';
 import type { GotOptions } from './types';
 
 export type HostRulesGotOptions = Pick<
@@ -163,8 +163,8 @@ export function applyHostRules<GotOptions extends HostRulesGotOptions>(
     options.lookup = dnsLookup;
   }
 
-  if (foundRules.keepalive) {
-    options.agent = keepaliveAgents;
+  if (foundRules.keepAlive) {
+    options.agent = keepAliveAgents;
   }
 
   if (!hasProxy() && foundRules.enableHttp2 === true) {
diff --git a/lib/util/http/keepalive.ts b/lib/util/http/keep-alive.ts
similarity index 73%
rename from lib/util/http/keepalive.ts
rename to lib/util/http/keep-alive.ts
index abc46edfa1..c98c5d84be 100644
--- a/lib/util/http/keepalive.ts
+++ b/lib/util/http/keep-alive.ts
@@ -4,9 +4,9 @@ import type { Agents } from 'got';
 const http = new Agent();
 const https = new HttpsAgent();
 
-const keepaliveAgents: Agents = {
+const keepAliveAgents: Agents = {
   http,
   https,
 };
 
-export { keepaliveAgents };
+export { keepAliveAgents };
-- 
GitLab