ExUtcp.Config (ex_utcp v0.2.8)

View Source

Configuration management for UTCP client.

Handles variable substitution, environment variable loading, and provider configuration.

Summary

Functions

Gets a variable value from the configuration, checking in order

Loads variables from a .env file.

Creates a new client configuration with default values.

Substitutes variables in a value using the pattern ${VAR} or $VAR.

Functions

get_variable(config, key)

@spec get_variable(ExUtcp.Types.client_config(), String.t()) ::
  {:ok, String.t()} | {:error, ExUtcp.Types.variable_not_found()}

Gets a variable value from the configuration, checking in order:

  1. Inline variables
  2. Loaded variable sources
  3. System environment variables

load_from_env_file(path)

@spec load_from_env_file(String.t()) ::
  {:ok, %{required(String.t()) => String.t()}} | {:error, any()}

Loads variables from a .env file.

new(opts \\ [])

Creates a new client configuration with default values.

substitute_variables(config, value)

@spec substitute_variables(ExUtcp.Types.client_config(), any()) :: any()

Substitutes variables in a value using the pattern ${VAR} or $VAR.