Kuddle.Config (Kuddle Config v0.3.0) View Source

Utility module for handling various sources of configuration using Kuddle.

Link to this section Summary

Functions

Load a config map from a given kdl blob.

Load config from a directory, the extensions of the config files must be supplied as well.

Load config from a given kuddle document.

Link to this section Functions

Link to this function

load_config_blob(blob, config \\ [])

View Source

Specs

load_config_blob(String.t(), Keyword.t()) ::
  {:ok, Keyword.t()} | {:error, term()}

Load a config map from a given kdl blob.

Usage:

{:ok, config} = Kuddle.Config.load_config_blob("""
my_application {
  key "value"
  key2 subkey="subvalue"
}
""")
Link to this function

load_config_directory(directory_path, extensions, config \\ [])

View Source

Load config from a directory, the extensions of the config files must be supplied as well.

Usage:

{:ok, config} =
  Kuddle.Config.load_config_directory("/path/to/kdl/config/directory", [".kdl", ".kuddle"])
Link to this function

load_config_document(document, acc \\ [])

View Source

Specs

load_config_document(Kuddle.document(), Keyword.t()) ::
  {:ok, Keyword.t()} | {:error, term()}

Load config from a given kuddle document.

Usage:

=

Kuddle.Config.load_config_document(document)
Link to this function

load_config_file(filename, config \\ [])

View Source

Specs

load_config_file(Path.t(), Keyword.t()) :: {:ok, Keyword.t()} | {:error, term()}

Load a KDL config file

Usage:

{:ok, config} = Kuddle.Config.load_config_file("/path/to/kdl/config/file")