<A>(config: Config.Config<A>): SwappableField<A>A hot-swappable field whose key joins the process-wide allowlist — declare it anywhere (even at module scope), no wiring, and setByKey can swap it by string on any runtime. Reach for this when a remote/RPC handler swaps the value. For a field with no global footprint, scoped to one provision, use swappable.
export const const globalSwappable: <A>(
config: Config.Config<A>
) => SwappableField<A>
A hot-swappable field whose key joins the process-wide allowlist — declare it anywhere
(even at module scope), no wiring, and
setByKey
can swap it by string on any runtime.
Reach for this when a remote/RPC handler swaps the value. For a field with no global footprint,
scoped to one provision, use
swappable
.
globalSwappable = <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 const envKeys: readonly string[]envKeys = 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);
// joins the process-wide allowlist registry
for (const const key: stringkey of const envKeys: readonly string[]envKeys) {
const registerSwappable: (
key: string,
config: Config.Config<unknown>
) => void
registerSwappable(const key: stringkey, 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);
}
return 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 envKeys: readonly string[]envKeys);
};