Class: Dynomite::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dynomite/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dynomite/config.rb', line 6

def initialize
  @logger = Logger.new($stderr)
  @logger.formatter = ActiveSupport::Logger::SimpleFormatter.new
  @log_level = :info
  @namespace_separator = "_"
  @endpoint = ENV['DYNOMITE_ENDPOINT'] # allow to use local dynamodb
  @env = ActiveSupport::StringInquirer.new(ENV['DYNOMITE_ENV'] || "development")
  @default_count_method = :count # slow but accurate. :item_count is faster but can be stale by 6 hours
  @warn_on_scan = true
  @discover_fields = false
  @migration = ActiveSupport::OrderedOptions.new
  @undeclared_field_behavior = :warn # warn silent error allow
  # Not implemented: :datetime, :date, :float, :array, :set, :map
  # as we aws-sdk-dynamodb handles it via :infer
  @default_field_type = :infer # :string, :integer, :boolean, :time, :infer
  @update_strategy = :put_item # :put_item, :update_item
end

Instance Attribute Details

#default_count_methodObject

Returns the value of attribute default_count_method.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def default_count_method
  @default_count_method
end

#default_field_typeObject

Returns the value of attribute default_field_type.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def default_field_type
  @default_field_type
end

#default_namespaceObject

Returns the value of attribute default_namespace.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def default_namespace
  @default_namespace
end

#discover_fieldsObject

Returns the value of attribute discover_fields.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def discover_fields
  @discover_fields
end

#endpointObject

Returns the value of attribute endpoint.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def endpoint
  @endpoint
end

#envObject

Returns the value of attribute env.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def env
  @env
end

#log_levelObject

Returns the value of attribute log_level.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def logger
  @logger
end

#migrationObject

Returns the value of attribute migration.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def migration
  @migration
end

#namespaceObject



35
36
37
# File 'lib/dynomite/config.rb', line 35

def namespace
  ENV['DYNOMITE_NAMESPACE'] || @namespace || @default_namespace || 'dynomite'
end

#namespace_separatorObject

Returns the value of attribute namespace_separator.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def namespace_separator
  @namespace_separator
end

#undeclared_field_behaviorObject

Returns the value of attribute undeclared_field_behavior.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def undeclared_field_behavior
  @undeclared_field_behavior
end

#update_strategyObject

Returns the value of attribute update_strategy.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def update_strategy
  @update_strategy
end

#warn_on_scanObject

Returns the value of attribute warn_on_scan.



3
4
5
# File 'lib/dynomite/config.rb', line 3

def warn_on_scan
  @warn_on_scan
end