opencode/packages/server/test/fixture/server.ts

19 lines
610 B
TypeScript

import { Effect } from "effect"
import { HttpServer } from "effect/unstable/http"
import { ServerProcess } from "../../src/process"
export const startServer = Effect.fnUntraced(function* (directory: string) {
const server = yield* ServerProcess.start<never, never>({
hostname: "127.0.0.1",
port: 0,
password: "secret",
app: { version: "test-version" },
database: { path: ":memory:" },
config: { directory },
fs: { filewatcher: false },
})
return {
base: HttpServer.formatAddress(server.address),
headers: { authorization: `Basic ${btoa("opencode:secret")}` },
}
})