24 lines
565 B
TypeScript
24 lines
565 B
TypeScript
import { Effect, flow, Layer, Match } from "effect"
|
|
import { ServerConfig } from "./config"
|
|
import { HttpAppLive } from "./http"
|
|
|
|
|
|
const ServerDevelopment = Layer.empty.pipe(
|
|
Layer.provideMerge(HttpAppLive),
|
|
)
|
|
|
|
const ServerProduction = Layer.empty.pipe(
|
|
Layer.provideMerge(HttpAppLive),
|
|
)
|
|
|
|
export const Server = ServerConfig.mode.pipe(
|
|
Effect.map(flow(
|
|
Match.value,
|
|
Match.when("development", () => ServerDevelopment),
|
|
Match.when("production", () => ServerProduction),
|
|
Match.exhaustive,
|
|
)),
|
|
|
|
Layer.unwrapEffect,
|
|
)
|