class Figroll::Config

A configuration object for Figroll

Attributes

data[R]

Values defined in the configuration to inject into Figroll @return [Array<String>, nil] @api private

environment[R]

The `FIGROLL_ENV` under which we're running @return [String, nil] @api private

required[R]

A list of required environment variables defined by the configuration @return [Array<String>, nil] @api private

Public Class Methods

new() click to toggle source

Create a new Config instance @api private

# File lib/figroll/config.rb, line 25
def initialize
  reset
end

Public Instance Methods

load_file(config_file) click to toggle source

Given a config file name, load the configuration specified in that file. @param config_file [String] @api private

# File lib/figroll/config.rb, line 32
def load_file(config_file)
  return unless File.exists?(config_file)

  file_data = YAML.load_file(config_file) || {}

  # set up required keys
  file_data['required'] ||= []
  file_data['required'].each do |key|
    required.push(Util.normalize(key))
  end

  # load up the environment-specific data
  file_data['environments'] ||= {}
  @data = file_data['environments'][environment] || {}
end

Private Instance Methods

reset() click to toggle source
# File lib/figroll/config.rb, line 49
def reset
  @environment = ENV['FIGROLL_ENV']
  @required = []
  @data = {}
end