Sha256: 7b01236dd46dabc29febdb122a4fea17d71cde2f95c54e9455ffbf63c843553b

Contents?: true

Size: 685 Bytes

Versions: 14

Compression:

Stored size: 685 Bytes

Contents

module Heirloom
  class Config

    attr_accessor :access_key, :secret_key, :metadata_region, :logger

    def initialize(args = {})
      @config = args.fetch :config, load_config_file
      self.logger = args[:logger] ||= HeirloomLogger.new
      load_config
    end

    def load_config
      aws = @config['aws']
      self.access_key = aws['access_key']
      self.secret_key = aws['secret_key']
      self.metadata_region = aws['metadata_region']
    end

    def load_config_file
      config_file = "#{ENV['HOME']}/.heirloom.yml"

      if File.exists? config_file
        YAML::load File.open(config_file)
      else
        { 'aws' => Hash.new }
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
heirloom-0.8.1 lib/heirloom/config.rb
heirloom-0.8.0 lib/heirloom/config.rb
heirloom-0.7.4 lib/heirloom/config.rb
heirloom-0.7.3 lib/heirloom/config.rb
heirloom-0.7.3rc2 lib/heirloom/config.rb
heirloom-0.7.3rc1 lib/heirloom/config.rb
heirloom-0.7.2 lib/heirloom/config.rb
heirloom-0.7.2rc2 lib/heirloom/config.rb
heirloom-0.7.2rc1 lib/heirloom/config.rb
heirloom-0.7.1 lib/heirloom/config.rb
heirloom-0.7.0 lib/heirloom/config.rb
heirloom-0.7.0rc1 lib/heirloom/config.rb
heirloom-0.6.1 lib/heirloom/config.rb
heirloom-0.6.0rc1 lib/heirloom/config.rb