Class: Anyway::Loaders::EJSON
Class Attribute Summary collapse
-
.bin_path ⇒ Object
Returns the value of attribute bin_path.
Instance Method Summary collapse
Methods inherited from Base
call, #initialize, #use_local?
Methods included from Tracing
capture, current_trace, current_trace_source, source_stack, trace!, trace_stack, with_trace_source
Constructor Details
This class inherits a constructor from Anyway::Loaders::Base
Class Attribute Details
.bin_path ⇒ Object
Returns the value of attribute bin_path.
9 10 11 |
# File 'lib/anyway/loaders/ejson.rb', line 9 def bin_path @bin_path end |
Instance Method Details
#call(name:, ejson_namespace: name, ejson_parser: Anyway::EJSONParser.new(EJSON.bin_path), **_options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/anyway/loaders/ejson.rb', line 14 def call(name:, ejson_namespace: name, ejson_parser: Anyway::EJSONParser.new(EJSON.bin_path), **) configs = [] rel_config_paths.each do |rel_config_path| secrets_hash, rel_path = extract_hash_from_rel_config_path( ejson_parser: ejson_parser, rel_config_path: rel_config_path ) next unless secrets_hash config_hash = if ejson_namespace secrets_hash[ejson_namespace] else secrets_hash.except("_public_key") end next unless config_hash.is_a?(Hash) configs << trace!(:ejson, path: rel_path) do config_hash end end return {} if configs.empty? configs.inject do |result_config, next_config| Utils.deep_merge!(result_config, next_config) end end |