Class: ElasticGraph::DatastoreCore::Config
- Inherits:
-
Object
- Object
- ElasticGraph::DatastoreCore::Config
- Defined in:
- lib/elastic_graph/datastore_core/config.rb
Overview
Defines the configuration related to datastores.
Constant Summary collapse
- EXPECTED_KEYS =
members.map(&:to_s)
Class Method Summary collapse
-
.from_parsed_yaml(parsed_yaml) ⇒ Object
Helper method to build an instance from parsed YAML config.
Class Method Details
.from_parsed_yaml(parsed_yaml) ⇒ Object
Helper method to build an instance from parsed YAML config.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elastic_graph/datastore_core/config.rb', line 38 def self.from_parsed_yaml(parsed_yaml) parsed_yaml = parsed_yaml.fetch("datastore") extra_keys = parsed_yaml.keys - EXPECTED_KEYS unless extra_keys.empty? raise ConfigError, "Unknown `datastore` config settings: #{extra_keys.join(", ")}" end new( client_faraday_adapter: Configuration::ClientFaradayAdapter.from_parsed_yaml(parsed_yaml), clusters: Configuration::ClusterDefinition.definitions_by_name_hash_from(parsed_yaml.fetch("clusters")), index_definitions: Configuration::IndexDefinition.definitions_by_name_hash_from(parsed_yaml.fetch("index_definitions")), log_traffic: parsed_yaml.fetch("log_traffic", false), max_client_retries: parsed_yaml.fetch("max_client_retries", 3) ) end |