Package: effect
Module: ConfigProvider
Transforms the path segments before they reach the underlying store.
When to use
Use when you need to rename, re-case, or otherwise transform config path segments before lookup.
Details
The function f receives the whole path produced by earlier provider
transformations and must return a new path. Lookup path transformations
compose in application order: the existing transformation runs first, then
f runs. For providers composed with orElse, the transformation is
applied to each operand.
Example (Uppercasing path segments)
import { ConfigProvider } from "effect"
const provider = ConfigProvider.fromEnv({
env: { APP_HOST: "localhost" }
})
const upper = ConfigProvider.mapInput(provider, (path) =>
path.map((seg) =>
typeof seg === "string" ? seg.toUpperCase() : seg
)
)
See
constantCase – a preset that converts to CONSTANT_CASEnested – for prepending a prefix instead of transformingSignature
declare const mapInput: { (f: (path: Path) => Path): (self: ConfigProvider) => ConfigProvider; (self: ConfigProvider, f: (path: Path) => Path): ConfigProvider; }
Since v4.0.0