From 000c5bda35e1ef5f5b1f8858e7d35e1c67269ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 15 Jul 2024 04:18:54 +0200 Subject: [PATCH] Mode config --- packages/server/src/config.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/server/src/config.ts b/packages/server/src/config.ts index e797ac9..da44c81 100644 --- a/packages/server/src/config.ts +++ b/packages/server/src/config.ts @@ -1,6 +1,18 @@ +import { Schema as S } from "@effect/schema" import { Config } from "effect" +export const mode = Config.string("NODE_ENV").pipe( + Config.withDefault("development"), + Config.validate({ + message: "Expected 'development' or 'production'", + validation: S.is(S.Union( + S.Literal("development"), + S.Literal("production"), + )), + }) +) + export const httpPort = Config.number("HTTP_PORT").pipe(Config.withDefault(8080)) export const rpcHTTPRoot = Config.string("RPC_HTTP_ROOT").pipe(Config.withDefault("/rpc")) export const rpcHTTPPlaygroundRoot = Config.string("RPC_HTTP_PLAYGROUND_ROOT").pipe(Config.withDefault("/rpc/playground"))