refactor(config): migrate Server + Layout to Effect Schema (#23216)

This commit is contained in:
Kit Langton
2026-04-18 01:20:06 +00:00
committed by GitHub
parent 23a2d01282
commit 826fd3350c
4 changed files with 43 additions and 27 deletions
+20
View File
@@ -0,0 +1,20 @@
import { Schema } from "effect"
import { zod } from "@/util/effect-zod"
export class Server extends Schema.Class<Server>("ServerConfig")({
port: Schema.optional(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0))).annotate({
description: "Port to listen on",
}),
hostname: Schema.optional(Schema.String).annotate({ description: "Hostname to listen on" }),
mdns: Schema.optional(Schema.Boolean).annotate({ description: "Enable mDNS service discovery" }),
mdnsDomain: Schema.optional(Schema.String).annotate({
description: "Custom domain name for mDNS service (default: opencode.local)",
}),
cors: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({
description: "Additional domains to allow for CORS",
}),
}) {
static readonly zod = zod(this)
}
export * as ConfigServer from "./server"