Module: Cassie::Configuration::Core
Overview
Extend a class with Core to add configuration management methods and attributes
Instance Attribute Summary collapse
-
#configuration ⇒ Hash{String,Symbol => Object}
The currently active configuration used for initializing new cluster connections.
-
#configurations ⇒ Hash{String => [Hash]}
The cluster configurations available for all environments.
-
#env ⇒ Object
The currently active environment.
-
#keyspace ⇒ Object
The currently selected keyspace.
Instance Method Summary collapse
-
#paths ⇒ Hash
Paths used for configuration loading.
Methods included from Loading
Instance Attribute Details
#configuration ⇒ Hash{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 |
#configurations ⇒ Hash{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 |
#env ⇒ Object
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 |
#keyspace ⇒ Object
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
#paths ⇒ Hash
Paths used for configuration loading.
34 35 36 |
# File 'lib/cassie/configuration/core.rb', line 34 def paths @paths ||= {}.with_indifferent_access end |