Package: effect
Module: Config
Creates a config for a boolean value parsed from common string representations.
When to use
Use to read boolean flags from string-like config sources.
Details
Shortcut for Config.schema(Config.Boolean, name).
Accepted values: true, false, yes, no, on, off, 1, 0,
y, n.
Example (Reading a boolean flag)
import { Config, ConfigProvider, Effect } from "effect"
const program = Effect.gen(function*() {
const flag = yield* Config.boolean("FEATURE_FLAG")
console.log(flag)
})
const provider = ConfigProvider.fromEnv({
env: {
FEATURE_FLAG: "yes"
}
})
Effect.runSync(
program.pipe(Effect.provideService(ConfigProvider.ConfigProvider, provider))
)
// Output: true
See
Boolean for the underlying boolean codecSignature
declare const boolean: (name?: string) => Config<boolean>
Since v2.0.0