kata_env

Types

pub type EnvError {
  SchemaError(errors: List(error.Error))
}

Constructors

  • SchemaError(errors: List(error.Error))

    Schema validation failed (missing or invalid env vars)

Values

pub fn decode(schema: schema.Schema(a)) -> Result(a, EnvError)

Read all environment variables and decode using a schema. Field keys in the schema correspond to env var names.

pub fn decode_keys(
  schema: schema.Schema(a),
  keys: List(String),
) -> Result(a, EnvError)

Decode from a specific set of env var names. Only reads the specified keys from the environment.

pub fn format() -> format.Format(dict.Dict(String, String))

Environment variable format for use with kata/format.decode and kata/format.encode.

pub fn parse(
  env: dict.Dict(String, String),
) -> Result(value.Value, String)

Parse an env dict into a Value (schema-independent).

pub fn serialize(
  v: value.Value,
) -> Result(dict.Dict(String, String), String)

Serialize a Value to an env dict (schema-independent). Only VObject with string-representable values is supported.

Search Document