mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-05 20:29:54 +00:00
serve: inline node listen options
This commit is contained in:
parent
d1f44d4cd2
commit
cb45de6fd2
1 changed files with 4 additions and 6 deletions
|
|
@ -250,7 +250,10 @@ function serverLayer(opts: ListenOptions) {
|
|||
}) as typeof server.close
|
||||
|
||||
return Layer.mergeAll(
|
||||
NodeHttpServer.layer(() => server, nodeListenOptions(opts)),
|
||||
NodeHttpServer.layer(() => server, {
|
||||
...(opts.type === "socket" ? { path: opts.socket } : { port: opts.port, host: opts.hostname }),
|
||||
gracefulShutdownTimeout: "1 second",
|
||||
}),
|
||||
Layer.succeed(ListenerServerService)(
|
||||
ListenerServerService.of({
|
||||
closeAll: Effect.sync(() => {
|
||||
|
|
@ -262,9 +265,4 @@ function serverLayer(opts: ListenOptions) {
|
|||
)
|
||||
}
|
||||
|
||||
function nodeListenOptions(opts: ListenOptions) {
|
||||
if (opts.type === "socket") return { path: opts.socket, gracefulShutdownTimeout: "1 second" as const }
|
||||
return { port: opts.port, host: opts.hostname, gracefulShutdownTimeout: "1 second" as const }
|
||||
}
|
||||
|
||||
export * as Server from "./server"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue