Module: Cassie::Configuration::Core

Includes:
Loading
Included in:
Cassie
Defined in:
lib/cassie/configuration/core.rb

Overview

Extend a class with Core to add configuration management methods and attributes

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configurationHash{String,Symbol => Object}

The currently active configuration used for initializing new cluster connections. If none has been set, the configuration for the current #env is used from #configuration

Note: setting a #configuration value will override the #configurations attribute, rendering it useless


61
62
63
64
# File 'lib/cassie/configuration/core.rb', line 61

def configuration
  return @configuration if defined?(@configuration)
  configurations[env]
end

#configurationsHash{String => [Hash]}

The cluster configurations available for all environments


41
42
43
# File 'lib/cassie/configuration/core.rb', line 41

def configurations
  @configurations ||= cluster_configurations
end

#envObject

The currently active environment. Used to select which configuration will be used


22
23
24
# File 'lib/cassie/configuration/core.rb', line 22

def env
  @env ||= ActiveSupport::StringInquirer.new(ENV["CASSANDRA_ENV"] || ENV["RACK_ENV"] || "development")
end

#keyspaceObject

The currently selected keyspace. If no keyspace has been explicitly set, then the default :keyspace from #configuration is used.


12
13
14
# File 'lib/cassie/configuration/core.rb', line 12

def keyspace
  @keyspace
end

Instance Method Details

#cluster_configurationsHash{String => Object} Originally defined in module Loading

Fetch cluster configurations from configuraiton file located at paths

#pathsHash

Paths used for configuration loading.


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

def paths
  @paths ||= {}.with_indifferent_access
end