Package: effect
Module: Config
Provides a fallback config when parsing fails with a ConfigError.
When to use
Use when you need to try an alternative config source after the primary one fails.
Details
Unlike withDefault, this catches all ConfigErrors (not just
missing data). The fallback function receives the error and returns a new
Config.
Example (Falling back to a literal)
import { Config } from "effect"
const hostConfig = Config.string("HOST").pipe(
Config.orElse(() => Config.succeed("localhost"))
)
See
withDefault – fallback only on missing dataSignature
declare const orElse: { <A2>(that: (error: ConfigError) => Config<A2>): <A>(self: Config<A>) => Config<A2 | A>; <A, A2>(self: Config<A>, that: (error: ConfigError) => Config<A2>): Config<A | A2>; }
Since v2.0.0