CFG.Config (cfg_lib v0.1.0) View Source
This module contains top-level functionality for working with CFG. Client code will usually just interact with this module.
Link to this section Summary
Functions
Append or prepend a list of directories to the include path of this configuration.
Return this configuration as a map, recursing into included configurations.
Returns a specification to start this module under a supervisor.
Return a configuration from a file, given its path.
Return a configuration from its source.
Get a value from this configuration by key or path, with an optional default value if not found. If no default is specified and a value isn't found, an error will be returned.
Get the include path of this configuration.
See whether this configuration allows duplicates.
See whether this configuration uses a cache.
See if the specified value is a configuration.
Load this configuration from a file, given its path.
Return a new, empty configuration with specified options.
Set whether this configuration uses a cache.
Set the include path of this configuration to the specified list of directories.
Set whether this configuration allows duplicates.
Set the path from which this configuration was loaded. This is also used to determine the directory searched for included configurations.
Link to this section Types
Specs
t() :: %CFG.Config{ cache: nil | map(), context: nil | map(), data: nil | map(), error: term(), include_path: list(), no_duplicates: boolean(), parent: nil | pid(), path: nil | binary(), refs_seen: term(), root_dir: nil | binary(), scalar_tokens: term(), strict_conversions: boolean(), string_converter: function() }
This type represents a configuration loaded from CFG source.
These are its fields:
no_duplicates
- Whether duplicate keys are allowed. If allowed, newer values for a given key silently overwrite older ones. If not and a duplicate is seen, an error is returned.strict_conversions
- Whether conversions of backtick-strings are allowed to fail. If not strict, a failure results in the special string being returned. Otherwise, an error is returned.context
- An optional map containing a variable name-to-value mapping.include_path
- A list of directories which is searched for included configurations. The directory of the including configuration is searched first.path
- The absolute path from where the configuration was loaded.root_dir
- The directory containingpath
.parent
- The parent configuration of an included configuration.string_converter
- A function which is called with a string and the configuration to perform backtick-string conversion.
Link to this section Functions
Specs
Append or prepend a list of directories to the include path of this configuration.
Specs
Return this configuration as a map, recursing into included configurations.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
Return a configuration from a file, given its path.
Specs
Return a configuration from its source.
Specs
Get a value from this configuration by key or path, with an optional default value if not found. If no default is specified and a value isn't found, an error will be returned.
Specs
Get the include path of this configuration.
Specs
See whether this configuration allows duplicates.
Specs
See whether this configuration uses a cache.
Specs
See if the specified value is a configuration.
Specs
Load this configuration from a file, given its path.
Specs
Return a new, empty configuration with specified options.
Specs
Set whether this configuration uses a cache.
Specs
Set the include path of this configuration to the specified list of directories.
Specs
Set whether this configuration allows duplicates.
Specs
Set the path from which this configuration was loaded. This is also used to determine the directory searched for included configurations.