View Source Kuddle.Config (Kuddle Config v1.0.0)

Utility module for handling various sources of configuration using Kuddle.

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.

Functions

load_config_blob(blob, config \\ [])

@spec 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"
}
""")

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

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"])

load_config_document(document, acc \\ [])

@spec 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)

load_config_file(filename, config \\ [])

@spec 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")