Class: Eventosaurus::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/eventosaurus/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



39
40
41
# File 'lib/eventosaurus/configuration.rb', line 39

def initialize
  @logger = Logger.new(STDOUT)
end

Instance Attribute Details

#aws_access_key_idObject

Returns the value of attribute aws_access_key_id.



28
29
30
# File 'lib/eventosaurus/configuration.rb', line 28

def aws_access_key_id
  @aws_access_key_id
end

#aws_endpointObject

Returns the value of attribute aws_endpoint.



29
30
31
# File 'lib/eventosaurus/configuration.rb', line 29

def aws_endpoint
  @aws_endpoint
end

#aws_regionObject

Returns the value of attribute aws_region.



31
32
33
# File 'lib/eventosaurus/configuration.rb', line 31

def aws_region
  @aws_region
end

#aws_secret_access_keyObject

Returns the value of attribute aws_secret_access_key.



30
31
32
# File 'lib/eventosaurus/configuration.rb', line 30

def aws_secret_access_key
  @aws_secret_access_key
end

#dynamodb_clientObject

Returns the value of attribute dynamodb_client.



33
34
35
# File 'lib/eventosaurus/configuration.rb', line 33

def dynamodb_client
  @dynamodb_client
end

#dynamodb_table_namespaceObject

Returns the value of attribute dynamodb_table_namespace.



34
35
36
# File 'lib/eventosaurus/configuration.rb', line 34

def dynamodb_table_namespace
  @dynamodb_table_namespace
end

#dynamodb_warn_on_scanObject

Returns the value of attribute dynamodb_warn_on_scan.



35
36
37
# File 'lib/eventosaurus/configuration.rb', line 35

def dynamodb_warn_on_scan
  @dynamodb_warn_on_scan
end

#environment_prefixObject

Returns the value of attribute environment_prefix.



32
33
34
# File 'lib/eventosaurus/configuration.rb', line 32

def environment_prefix
  @environment_prefix
end

#loggerObject

Returns the value of attribute logger.



36
37
38
# File 'lib/eventosaurus/configuration.rb', line 36

def logger
  @logger
end

#persistorObject

Returns the value of attribute persistor.



37
38
39
# File 'lib/eventosaurus/configuration.rb', line 37

def persistor
  @persistor
end

Instance Method Details

#aws_credentialsObject



59
60
61
62
63
64
65
# File 'lib/eventosaurus/configuration.rb', line 59

def aws_credentials
  self.aws_region ||= 'us-east-2'
  self.aws_access_key_id ||= 'unset'
  self.aws_secret_access_key ||= 'unset'

  @aws_credientials ||= Aws::Credentials.new(aws_access_key_id, aws_secret_access_key)
end

#configure_awsObject



55
56
57
# File 'lib/eventosaurus/configuration.rb', line 55

def configure_aws
  Aws.config.update(region: aws_region, credentials: aws_credentials)
end

#configure_dynamodbObject



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/eventosaurus/configuration.rb', line 67

def configure_dynamodb
  self.environment_prefix ||= 'unset'

  args = {
    region: aws_region,
    credentials: aws_credentials
  }

  args[:endpoint] = aws_endpoint if aws_endpoint.present?

  self.dynamodb_client = Aws::DynamoDB::Client.new(args)
end

#use_sidekiqObject



49
50
51
52
53
# File 'lib/eventosaurus/configuration.rb', line 49

def use_sidekiq
  require 'eventosaurus/persistors/sidekiq'

  @persistor = Eventosaurus::Persistors::Sidekiq
end

#use_synchronousObject



43
44
45
46
47
# File 'lib/eventosaurus/configuration.rb', line 43

def use_synchronous
  require 'eventosaurus/persistors/synchronous'

  @persistor = Eventosaurus::Persistors::Synchronous
end