Effect Config for the Ready wait bound (HYPERLINK_LAUNCHER_READY_TIMEOUT).
Read automatically when ready.timeout is omitted (default 30 seconds).
export const const readyTimeoutConfig: Config.Config<Duration.Duration>const readyTimeoutConfig: {
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;
}
Effect
Config
for the Ready wait bound (HYPERLINK_LAUNCHER_READY_TIMEOUT).
Read automatically when ready.timeout is omitted (default 30 seconds).
readyTimeoutConfig: 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<import DurationDuration.Duration> =
import ConfigConfig.function duration(
name?: string
): Config.Config<Duration.Duration>
Creates a config for a Duration value parsed from a human-readable
string.
When to use
Use to read time duration settings such as timeouts, intervals, or TTLs.
Details
Shortcut for Config.schema(Schema.DurationFromString, name).
Accepts any string that Duration.fromInput can parse (e.g.
"10 seconds", "500 millis", "Infinity", "-Infinity").
Example (Reading a duration)
import { Config, ConfigProvider, Effect } from "effect"
const program = Effect.gen(function*() {
const duration = yield* Config.duration("DURATION")
console.log(duration)
})
const provider = ConfigProvider.fromEnv({
env: {
DURATION: "10 seconds"
}
})
Effect.runSync(
program.pipe(Effect.provideService(ConfigProvider.ConfigProvider, provider))
)
// Output: Duration { _tag: "millis", value: 10000 }
duration("HYPERLINK_LAUNCHER_READY_TIMEOUT").Pipeable.pipe<Config.Config<Duration.Duration>, Config.Config<Duration.Duration>>(this: Config.Config<Duration.Duration>, ab: (_: Config.Config<Duration.Duration>) => Config.Config<Duration.Duration>): Config.Config<Duration.Duration> (+21 overloads)pipe(
import ConfigConfig.const withDefault: {
<A2>(defaultValue: A2): <A>(
self: Config<A>
) => Config<A2 | A>
<A, A2>(
self: Config<A>,
defaultValue: A2
): Config<A | A2>
}
Provides a fallback value when the config fails due to missing data.
When to use
Use when you need to make a config key optional with a sensible default.
Gotchas
Only applies when the error is a SchemaError caused exclusively by
missing data (missing keys, undefined values). Validation errors (wrong
type, out of range) still propagate.
Example (Defaulting a missing port)
import { Config, ConfigProvider, Effect } from "effect"
const port = Config.number("port").pipe(Config.withDefault(3000))
const provider = ConfigProvider.fromUnknown({})
// Effect.runSync(port.parse(provider)) // 3000
withDefault(const DEFAULT_READY_TIMEOUT: Duration.Durationconst DEFAULT_READY_TIMEOUT: {
value: DurationValue;
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;
}
Default Ready outer bound when ready.timeout is omitted and Config is unset.
DEFAULT_READY_TIMEOUT),
);