Sha256: 32688032be9789e0869b6b8b31acabf1875b85c66dfb6fc6fd76b0178f1460cf

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

module Heirloom
  class Config

    attr_accessor :access_key, :secret_key, :primary_region, :logger

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

    def load_config_file
      config_file = "#{ENV['HOME']}/.heirloom.yml"
      config = @config ? @config : YAML::load(File.open(config_file))

      aws = config['aws']

      self.access_key = aws['access_key']
      self.secret_key = aws['secret_key']
      self.primary_region = aws['primary_region'] ||= 'us-west-1'
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
heirloom-0.4.1rc1 lib/heirloom/config.rb
heirloom-0.4.0 lib/heirloom/config.rb
heirloom-0.3.1 lib/heirloom/config.rb
heirloom-0.3.0 lib/heirloom/config.rb
heirloom-0.3.0.rc1 lib/heirloom/config.rb