Class: Yutani::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/yutani/config.rb

Constant Summary collapse

CONFIG_FILE =
'.yutani.yml'
DEFAULTS =

Strings rather than symbols are used for compatibility with YAML.

Config[{
      "terraform_dir" => "terraform",
      "hiera_config"  => {
:backends  => ["yaml"]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(user_config) ⇒ Object

Returns a Configuration filled with defaults and fixed for common problems and backwards-compatibility.



21
22
23
# File 'lib/yutani/config.rb', line 21

def from(user_config)
  DEFAULTS.merge Config[user_config]
end

Instance Method Details

#read_config_fileObject



26
27
28
29
30
31
32
# File 'lib/yutani/config.rb', line 26

def read_config_file
  if File.exists? CONFIG_FILE
    YAML.load_file(CONFIG_FILE)
  else
    {}
  end
end