Config.Loader (secret_config v1.0.0)

Handles loading of configuration based on the environment setting.

It supports loading configuration from a YAML string, a YAML file, or an SSM parameter store, depending on the application's environment settings.

Link to this section Summary

Functions

Initializes the configuration state based on the provided environment.

Loads configuration based on the environment setting.

Link to this section Functions

Link to this function

init_state(env)

Specs

init_state(String.t() | nil) :: {:local, String.t(), map()} | nil

Initializes the configuration state based on the provided environment.

Parameters

  • env: The environment name as a string or nil.

Returns

  • The loaded configuration as a map, or nil if the environment is not set.
Link to this function

load_config(env)

Specs

load_config(String.t()) :: {:local, String.t(), map()} | any()

Loads configuration based on the environment setting.

Attempts to load configuration from a YAML string, then from a file, and finally falls back to loading from the SSM parameter store if the previous methods are not configured.

Parameters

  • env: The environment name as a string.

Returns

  • The loaded configuration as a map, wrapped in a tuple with :local and the environment, or directly from the SSM parameter store.