Module: Liam::Common

Included in:
Consumer, Producer
Defined in:
lib/liam/common.rb

Constant Summary collapse

CONFIG_FILE =
File.expand_path('config/liam.yml')

Instance Method Summary collapse

Instance Method Details

#client_optionsObject



9
10
11
12
13
14
15
16
# File 'lib/liam/common.rb', line 9

def client_options
  {
    access_key_id: env_credentials.dig('aws', 'access_key_id'),
    endpoint: env_credentials.dig('aws', 'sns', 'endpoint'),
    region: env_credentials.dig('aws', 'region'),
    secret_access_key: env_credentials.dig('aws', 'secret_access_key')
  }.compact
end

#credentialsObject



24
25
26
# File 'lib/liam/common.rb', line 24

def credentials
  YAML.load_file(CONFIG_FILE)
end

#env_credentialsObject



18
19
20
21
22
# File 'lib/liam/common.rb', line 18

def env_credentials
  return @env_credentials if defined?(@env_credentials)

  @env_credentials = credentials[ENV['RAILS_ENV']]
end