/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/stats/core/src/config.ts
23 строки
896 B
Adam
feat: initial datalake and stats site (#28666)
26 май 2026, 01:34
Не верифицирован
26 май 2026, 01:34
5b02ac4
Код
Авторство
О чём код?
import { Config, ConfigProvider, Effect, Layer, Schema } from "effect" import * as Context from "effect/Context" import { Resource } from "sst/resource" export class AppConfigValue extends Schema.Class<AppConfigValue>("AppConfigValue")({ stage: Schema.NonEmptyString, publicUrl: Schema.NonEmptyString, }) {} const decodeAppConfigValue = Schema.decodeUnknownSync(AppConfigValue) const config = Config.all({ stage: Config.succeed(Resource.App.stage), publicUrl: Config.string("PUBLIC_URL").pipe(Config.withDefault("http://localhost:3000")), }).pipe(Config.map(decodeAppConfigValue)) export class AppConfig extends Context.Service<AppConfig, AppConfigValue>()("@opencode/stats/AppConfig") { static readonly config = config static readonly layer: Layer.Layer<AppConfig, never, never> = Layer.effect( AppConfig, config.parse(ConfigProvider.fromEnv()).pipe(Effect.orDie), ) }