Initial version (#1)
All checks were successful
Build / build (push) Successful in 41s
Lint / lint (push) Successful in 13s

Co-authored-by: Julien Valverdé <julien.valverde@mailo.com>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2025-09-18 01:26:10 +02:00
parent ab2fff9a9f
commit c0cac90a66
47 changed files with 1633 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { NodeSdk } from "@effect/opentelemetry"
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base"
import { Effect, flow, Layer, Logger, Match } from "effect"
import { ServerConfig } from "./config"
import { HttpAppDevelopment, HttpAppProduction } from "./http"
const ServerDevelopment = Layer.empty.pipe(
Layer.provideMerge(NodeSdk.layer(() => ({
resource: { serviceName: "server" },
spanProcessor: new BatchSpanProcessor(new OTLPTraceExporter({ url: "http://tempo:4318/v1/traces" }))
}))),
Layer.provideMerge(HttpAppDevelopment),
)
const ServerProduction = Layer.empty.pipe(
Layer.provideMerge(HttpAppProduction),
)
export const Server = ServerConfig.mode.pipe(
Effect.map(flow(
Match.value,
Match.when("development", () => ServerDevelopment),
Match.when("production", () => ServerProduction),
Match.exhaustive,
)),
Layer.unwrapEffect,
Layer.provideMerge(Logger.pretty),
)