From d379a0ed145a55913695de169fed9868bfe936d1 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Fri, 20 Dec 2024 13:42:11 +0000 Subject: [PATCH] Use a specific type Refs #2122 --- src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9b8dacaf4..90d10ba50 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { FetchHttpClient } from '@effect/platform' import { NodeHttpServer, NodeRuntime } from '@effect/platform-node' import { LibsqlClient } from '@effect/sql-libsql' -import { Config, Effect, Function, Layer, Logger, LogLevel } from 'effect' +import { Config, Effect, Function, Layer, Logger, LogLevel, Schema } from 'effect' import { pipe } from 'fp-ts/lib/function.js' import { createServer } from 'http' import fetch from 'make-fetch-happen' @@ -35,7 +35,10 @@ pipe( Effect.provide( Layer.mergeAll( LibsqlClient.layerConfig({ - url: Config.string('LIBSQL_URL'), + url: Schema.Config( + 'LIBSQL_URL', + Schema.Union(Schema.TemplateLiteral('file:', Schema.String), Schema.Literal(':memory:'), Schema.URL), + ), authToken: Config.withDefault(Config.redacted('LIBSQL_AUTH_TOKEN'), undefined), }), Layer.effectDiscard(Effect.logDebug('Database connected')),