Sha256: 56032de36bce4c1fa5ba93af39b93440005f43a3531f2a3482b3bf3916be59ec

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 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 ? regions.first : 'us-west-1'
      self.bucket_prefix = c['aws']['bucket_prefix']
      self.authorized_aws_accounts = c['aws']['authorized_aws_accounts']
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heirloom-0.1.3 lib/heirloom/config.rb
heirloom-0.1.2 lib/heirloom/config.rb