MCPcopy Index your code
hub / github.com/Effect-TS/effect / load

Function load

packages/effect/src/internal/configProvider.ts:114–127  ·  view source on GitHub ↗
(
    path: ReadonlyArray<string>,
    primitive: Config.Config.Primitive<A>,
    split = true
  )

Source from the content-addressed store, hash-verified

112 typeof process !== "undefined" && "env" in process && typeof process.env === "object" ? process.env : {}
113
114 const load = <A>(
115 path: ReadonlyArray<string>,
116 primitive: Config.Config.Primitive<A>,
117 split = true
118 ): Effect.Effect<Array<A>, ConfigError.ConfigError> => {
119 const pathString = makePathString(path)
120 const current = getEnv()
121 const valueOpt = pathString in current ? Option.some(current[pathString]!) : Option.none()
122 return pipe(
123 valueOpt,
124 core.mapError(() => configError.MissingData(path, `Expected ${pathString} to exist in the process context`)),
125 core.flatMap((value) => parsePrimitive(value, path, primitive, seqDelim, split))
126 )
127 }
128
129 const enumerateChildren = (
130 path: ReadonlyArray<string>

Callers

nothing calls this directly

Calls 5

makePathStringFunction · 0.85
getEnvFunction · 0.85
parsePrimitiveFunction · 0.85
pipeFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected