module
Ameba::Config::Loader
Overview
By default config loads .ameba.yml file located in a current
working directory.
If it cannot be found until reaching the root directory, then it will be searched for in the user’s global config locations, which consists of a dotfile or a config file inside the XDG Base Directory specification.
~/.ameba.yml$XDG_CONFIG_HOME/ameba/config.yml(expands to~/.config/ameba/config.ymlif$XDG_CONFIG_HOMEis not set)
If both files exist, the dotfile will be selected.
As an example, if Ameba is invoked from inside /path/to/project/lib/utils,
then it will use the config as specified inside the first of the following files:
/path/to/project/lib/utils/.ameba.yml/path/to/project/lib/.ameba.yml/path/to/project/.ameba.yml/path/to/.ameba.yml/path/.ameba.yml/.ameba.yml~/.ameba.yml~/.config/ameba/config.yml
Extended Modules
Defined in:
ameba/config/loader.crConstant Summary
-
DEFAULT_PATH =
Path[Dir.current] / FILENAME -
DEFAULT_PATHS =
{Path["~"] / FILENAME, (Path[XDG_CONFIG_HOME] / "ameba") / "config.yml"} -
FILENAME =
".ameba.yml" -
XDG_CONFIG_HOME =
ENV.fetch("XDG_CONFIG_HOME", "~/.config")
Instance Method Summary
-
#load(path : Path | String | Nil = nil, root : Path | Nil = nil, skip_reading_config : Bool = false)
Loads YAML configuration file by
path.
Instance Method Detail
def load(path : Path | String | Nil = nil, root : Path | Nil = nil, skip_reading_config : Bool = false)
#
Loads YAML configuration file by path.
config = Ameba::Config.load