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[{
      "scripts_dir" => "scripts",
      "includes_dir" => "includes",
      "templates_dir" => "templates",
      "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.



24
25
26
# File 'lib/yutani/config.rb', line 24

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

Instance Method Details

#read_config_fileObject



29
30
31
32
33
34
35
# File 'lib/yutani/config.rb', line 29

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