Method: Res::Config#process
- Defined in:
- lib/res/config.rb
#process(args = {}) ⇒ Object
Load in config – this can come from three places:
-
Arguments passed to the initializer
-
From environment variables
-
From a config file
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/res/config.rb', line 20 def process( args = {} ) config_from_file = {} if args[:config_file] config_from_file = load_from_config(args[:config_file]) args.delete(:config_file) end missing = [] struct.members.each do |item| struct[item] = args[item] || ENV[(prepend + item.to_s).upcase] || config_from_file[item] || nil missing << item if (struct[item].nil? && required.include?(item)) end raise "Missing configuration: " + missing.join( ", ") if missing.any? end |