Class: Heirloom::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/heirloom/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Config

Returns a new instance of Config.



6
7
8
9
10
11
12
# File 'lib/heirloom/config.rb', line 6

def initialize(args={})
  @opts        = args[:opts] ||= Hash.new
  @logger      = args[:logger] ||= HeirloomLogger.new
  @environment = args[:environment] ||= 'default'
  @config      = load_config_file
  load_config
end

Instance Attribute Details

#access_keyObject

Returns the value of attribute access_key.



4
5
6
# File 'lib/heirloom/config.rb', line 4

def access_key
  @access_key
end

#environmentObject

Returns the value of attribute environment.



4
5
6
# File 'lib/heirloom/config.rb', line 4

def environment
  @environment
end

#loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/heirloom/config.rb', line 4

def logger
  @logger
end

#metadata_regionObject

Returns the value of attribute metadata_region.



4
5
6
# File 'lib/heirloom/config.rb', line 4

def 
  @metadata_region
end

#secret_keyObject

Returns the value of attribute secret_key.



4
5
6
# File 'lib/heirloom/config.rb', line 4

def secret_key
  @secret_key
end

#use_iam_profileObject

Returns the value of attribute use_iam_profile.



4
5
6
# File 'lib/heirloom/config.rb', line 4

def use_iam_profile
  @use_iam_profile
end

Instance Method Details

#load_configObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/heirloom/config.rb', line 14

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']
  @use_iam_profile = @opts.fetch :use_iam_profile,
                                 false
end