Header menu logo UnionConfig

Types Module

Reusable configuration types and utilities. This module contains generic types for building type-safe configuration systems.

Types and nested modules

Type/Module Description

ConfigValue (Module)

 Helpers for extracting typed values from ConfigValue.
 Use these with a `read` function that returns ConfigValue option:
   let port = read PORT |> ConfigValue.int
   let apiKey = read XAI_API_KEY |> ConfigValue.stringOption

ConfigRequirement

Whether a configuration variable is required for the app to start

ConfigValue (Type)

Parsed configuration value with its type

ConfigValueType

The runtime type of a configuration variable's value

ConfigVarDef

Core definition of a config variable (enough to read, parse, validate)

ConfigVarDoc

Documentation metadata for a config variable

ConfigVarKind

How a configuration variable gets its value

Functions and values

Function or value Description

parseBool s

Full Usage: parseBool s

Parameters:
    s : string

Returns: bool option

Parse a string as a boolean value Accepts: "true", "false", "1", "0" (case-insensitive, trimmed)

s : string
Returns: bool option

parseValue valueType rawValue

Full Usage: parseValue valueType rawValue

Parameters:
Returns: Result<ConfigValue, string>

Parse a string value into the expected type.

valueType : ConfigValueType
rawValue : string
Returns: Result<ConfigValue, string>

Type something to start searching.