Module: Cassie::Configuration::Loading

Included in:
Core
Defined in:
lib/cassie/configuration/loading.rb

Instance Method Summary collapse

Instance Method Details

#cluster_configurationsHash{String => Object}

Fetch cluster configurations from configuraiton file located at paths

Returns:

  • (Hash{String => Object})

    Configuration loaded from yml file



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cassie/configuration/loading.rb', line 7

def cluster_configurations
  path = paths["cluster_configurations"]

  file = begin
    File.new(path)
  rescue StandardError
    raise MissingClusterConfigurations.new(path)
  end

  require "yaml"
  require "erb"

  hash = YAML.load(ERB.new(file.read).result) || {}
  hash.with_indifferent_access
rescue StandardError => e
  raise e, "Cannot load Cassandra cluster configurations:\n#{e.message}", e.backtrace
end