Skip to content

Commit

Permalink
feat(cli): add keepAliveTimeout option
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Mar 18, 2024
1 parent 480e4dc commit afe2a9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/odd-monkeys-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@datatruck/cli": patch
---

Add `keepAliveTimeout` option
6 changes: 5 additions & 1 deletion packages/cli/src/utils/datatruck/repository-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type DatatruckRepositoryServerOptions = {
address?: string;
};
trustProxy?: true | { remoteAddressHeader: string };
keepAliveTimeout?: number;
allowlist?: {
/**
* @default true
Expand Down Expand Up @@ -109,7 +110,7 @@ export function createDatatruckRepositoryServer(
} = {},
) {
const counter = new Counter();
return createServer(async (req, res) => {
const server = createServer(async (req, res) => {
const url = req.url || "";
if (url === "/" || url === "/favicon.ico") return res.end();
const id = counter.next();
Expand Down Expand Up @@ -177,4 +178,7 @@ export function createDatatruckRepositoryServer(
if (!res.writableEnded) res.end();
}
});
if (typeof inOptions.keepAliveTimeout === "number")
server.keepAliveTimeout = inOptions.keepAliveTimeout;
return server;
}

0 comments on commit afe2a9c

Please sign in to comment.