feat(http): move HTTP server configuration application, enable flexible duration formats

This commit applies HTTP server configuration in `rootHttpRouterServiceFactory`
and adds support for multiple duration formats for timeouts. The previous
tests for server config have been moved and refactored. The documentation
and CHANGELOG have been updated to reflect the new configuration structure
and supported formats.

Signed-off-by: Beth Griggs <bethanyngriggs@gmail.com>
This commit is contained in:
Beth Griggs
2025-09-12 15:55:49 +01:00
parent ee06f7d181
commit d501e8c768
9 changed files with 175 additions and 128 deletions
+25
View File
@@ -95,6 +95,31 @@ export interface Config {
};
};
/**
* Server-level HTTP options configuration for the backend.
* These options are passed directly to the underlying Node.js HTTP server.
*
* Timeout values support multiple formats:
* - A number in milliseconds
* - A string in the format of '1d', '2 seconds' etc. as supported by the `ms` library
* - A standard ISO formatted duration string, e.g. 'P2DT6H' or 'PT1M'
* - An object with individual units (in plural) as keys, e.g. `{ days: 2, hours: 6 }`
*/
server?: {
/** Sets the timeout value for receiving the complete HTTP headers from the client. */
headersTimeout?: number | string | HumanDuration;
/** Sets the timeout value for receiving the entire request (headers and body) from the client. */
requestTimeout?: number | string | HumanDuration;
/** Sets the timeout value for inactivity on a socket during keep-alive. */
keepAliveTimeout?: number | string | HumanDuration;
/** Sets the timeout value for sockets. */
timeout?: number | string | HumanDuration;
/** Limits maximum incoming headers count. */
maxHeadersCount?: number;
/** Sets the maximum number of requests socket can handle before closing keep alive connection. */
maxRequestsPerSocket?: number;
};
/**
* Options used by the default auditor service.
*/