<A>(config: Config.Config<A>): SwappableField<A>A hot-swappable field with no global footprint — pure construction, no registry write. Its
typed control (.set / .reset / .changes) works wherever layer is provided; to also
open the string setByKey path for it, hand its config to layer(config), which scopes
the key to that one provision. Use globalSwappable for the declare-anywhere, process-wide
string path instead.
export const const swappable: <A>(
config: Config.Config<A>
) => SwappableField<A>
A hot-swappable field with no global footprint — pure construction, no registry write. Its
typed control (.set / .reset / .changes) works wherever
layer
is provided; to also
open the string
setByKey
path for it, hand its config to layer(config), which scopes
the key to that one provision. Use
globalSwappable
for the declare-anywhere, process-wide
string path instead.
swappable = <function (type parameter) A in <A>(config: Config.Config<A>): SwappableField<A>A>(config: Config.Config<A>(parameter) config: {
parse: (provider: ConfigProvider.ConfigProvider, pathPrefix?: Path) => Effect.Effect<T, ConfigError>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
config: import ConfigConfig.interface Config<out T>A recipe for extracting a typed value T from a ConfigProvider.
When to use
Use to describe typed configuration that can be parsed from a provider or
yielded inside Effect.gen.
Details
Key members:
parse(provider, pathPrefix?) – runs the config against a specific provider.
The optional path prefix is the logical scope accumulated from outer
Config.nested calls.
- Yieldable – can be yielded inside
Effect.gen, which automatically
resolves the current ConfigProvider from the context.
- Pipeable – supports
.pipe(Config.map(...)) etc.
Config<function (type parameter) A in <A>(config: Config.Config<A>): SwappableField<A>A>): interface SwappableField<A>A hot-swappable field: yieldable for reads, with control methods on the field
itself (yield* field reads; field.set(v) / field.reset / field.changes
control).
SwappableField<function (type parameter) A in <A>(config: Config.Config<A>): SwappableField<A>A> =>
const makeSwappableField: <A>(
config: Config.Config<A>,
envKeys: ReadonlyArray<string>
) => SwappableField<A>
makeSwappableField(config: Config.Config<A>(parameter) config: {
parse: (provider: ConfigProvider.ConfigProvider, pathPrefix?: Path) => Effect.Effect<T, ConfigError>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
config, const recordKeys: (
config: Config.Config<unknown>
) => ReadonlyArray<string>
recordKeys(config: Config.Config<A>(parameter) config: {
parse: (provider: ConfigProvider.ConfigProvider, pathPrefix?: Path) => Effect.Effect<T, ConfigError>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
config));