Skip to content

Instantly share code, notes, and snippets.

@8parth
Created August 13, 2017 17:26
Show Gist options
  • Save 8parth/65186f32f29488333cbc06389096db73 to your computer and use it in GitHub Desktop.
Save 8parth/65186f32f29488333cbc06389096db73 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
class DynamoDBConfig
include Singleton
attr_reader :client, :configs
def initialize
@configs ||= {
access_key_id: Rails.application.secrets.aws_access_key_id,
secret_access_key: Rails.application.secrets.aws_secret_access_key,
region: Rails.application.secrets.aws_region
}
case Rails.env
when 'test', 'development'
configs[:endpoint] = 'http://localhost:8000'
configs[:logger] = Rails.logger
end
@client ||= Aws::DynamoDB::Client.new(configs)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment