refactor(server): inject runtime options
This commit is contained in:
parent
ace77a5cf7
commit
0409e6884d
17 changed files with 146 additions and 74 deletions
|
|
@ -1,10 +1,22 @@
|
|||
import type { Database } from "@opencode-ai/core/database/database"
|
||||
import type { ModelsDev } from "@opencode-ai/core/models-dev"
|
||||
import { Database } from "@opencode-ai/core/database/database"
|
||||
import { ModelsDev } from "@opencode-ai/core/models-dev"
|
||||
import { Observability } from "@opencode-ai/core/observability"
|
||||
import { Schema } from "effect"
|
||||
|
||||
export interface ServerOptions {
|
||||
readonly hostname?: string
|
||||
readonly port?: number
|
||||
readonly password?: string
|
||||
readonly database?: Database.Options
|
||||
readonly models?: ModelsDev.Options
|
||||
}
|
||||
export const ServerOptions = Schema.Struct({
|
||||
hostname: Schema.optional(Schema.String),
|
||||
port: Schema.optional(
|
||||
Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(65_535)),
|
||||
),
|
||||
password: Schema.optional(Schema.String),
|
||||
database: Schema.optional(Database.Options),
|
||||
models: Schema.optional(ModelsDev.Options),
|
||||
observability: Schema.optional(Observability.Options),
|
||||
fs: Schema.optional(
|
||||
Schema.Struct({
|
||||
filewatcher: Schema.optional(Schema.Boolean),
|
||||
fff: Schema.optional(Schema.Boolean),
|
||||
}),
|
||||
),
|
||||
})
|
||||
export type ServerOptions = typeof ServerOptions.Type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue