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.



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

def config
  @config
end

.loggerObject



40
41
42
43
# File 'lib/porky_lib/config.rb', line 40

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

Class Method Details

.configure(options = {}) ⇒ Object



22
23
24
# File 'lib/porky_lib/config.rb', line 22

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

.initialize_awsObject



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

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