Module: CredStash::Repository

Defined in:
lib/cred_stash/repository.rb,
lib/cred_stash/repository/item.rb,
lib/cred_stash/repository/dynamo_db.rb

Defined Under Namespace

Classes: DynamoDB, Item

Class Method Summary collapse

Class Method Details

.instanceObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cred_stash/repository.rb', line 5

def self.instance
  case CredStash.config.storage
  when :dynamodb
    DynamoDB.new
  when :dynamodb_local
    endpoint = ENV['DYNAMODB_URL'] || 'http://localhost:8000'
    DynamoDB.new(
      client: Aws::DynamoDB::Client.new(
        endpoint: endpoint,
      )
    )
  else
    raise ArgumentError, "Unknown storage #{CredStash.config.storage}"
  end
end