Sha256: 3e5c1832ddd03a0c27ccec486869a22fa8e846e166b76ac2051b97d977c2446b
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
module Heirloom class Config attr_accessor :access_key, :secret_key, :metadata_region, :logger, :environment def initialize(args={}) @opts = args[:opts] ||= Hash.new @logger = args[:logger] ||= HeirloomLogger.new @environment = args[:environment] ||= 'default' @config = load_config_file load_config end def load_config @access_key = @opts.fetch :aws_access_key, @config['access_key'] @secret_key = @opts.fetch :aws_secret_key, @config['secret_key'] @metadata_region = @opts.fetch :metadata_region, @config['metadata_region'] end private def load_config_file config_file = "#{ENV['HOME']}/.heirloom.yml" if File.exists? config_file data = YAML::load File.open(config_file) if data.has_key? @environment data[@environment] else @logger.error "Environment '#{@environment}' not found in config file." exit 1 end else { } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
heirloom-0.11.0.beta.2 | lib/heirloom/config.rb |
heirloom-0.11.0.beta.1 | lib/heirloom/config.rb |