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



22
23
24
# File 'lib/liam/common.rb', line 22

def credentials
  YAML.load_file(CONFIG_FILE)
end

#env_credentialsObject



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

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