Sha256: f125d618382990ea911a45aae31650426994f1e398dea3d6b14147ca10740aee

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 Bytes

Contents

module Heirloom
  class Config

    attr_accessor :access_key, :secret_key, :regions, 
                  :primary_region, :bucket_prefix, :authorized_aws_accounts

    def initialize(args = {})
      @config = args[:config]
      load_config_file
    end

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

      self.access_key = c['aws']['access_key']
      self.secret_key = c['aws']['secret_key']
      self.regions = c['aws']['regions']
      self.primary_region = regions.first
      self.bucket_prefix = c['aws']['bucket_prefix']
      self.authorized_aws_accounts = c['aws']['authorized_aws_accounts']
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
heirloom-0.1.1 lib/heirloom/config.rb
heirloom-0.1.0 lib/heirloom/config.rb
heirloom-0.0.9 lib/heirloom/config.rb
heirloom-0.0.8 lib/heirloom/config.rb