Class: PorkyLib::Config

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



35
36
37
# File 'lib/porky_lib/config.rb', line 35

def config
  @config
end

.loggerObject



38
39
40
41
# File 'lib/porky_lib/config.rb', line 38

def self.logger
  @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
  @logger
end

Class Method Details

.configure(options = {}) ⇒ Object



20
21
22
# File 'lib/porky_lib/config.rb', line 20

def self.configure(options = {})
  options.each { |key, value| @config[key.to_sym] = value if @allowed_config_keys.include? key.to_sym }
end

.initialize_awsObject



24
25
26
27
28
29
30
31
32
# File 'lib/porky_lib/config.rb', line 24

def self.initialize_aws
  Aws.config.update(
    region: @config[:aws_region],
    credentials: Aws::Credentials.new(
      @config[:aws_key_id],
      @config[:aws_key_secret]
    )
  )
end