Class: RailsCredentialsManager::Get
- Defined in:
- lib/rails_credentials_manager/get.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#config_has_keys?, #configs, #initialize, #pastel, #print_key_and_value
Constructor Details
This class inherits a constructor from RailsCredentialsManager::Base
Instance Method Details
#perform(keys) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rails_credentials_manager/get.rb', line 3 def perform(keys) abort pastel.red("At least one key required") if keys.empty? keys_with_path = keys.index_with { |key| key.split(".").map(&:to_sym) } configs.each do |env, config| puts pastel.green("#{env}:") keys_with_path.each do |full_key, key_path| value = config_has_keys?(config, key_path) ? configs[env].dig(*key_path) : "not set" print_key_and_value(full_key, value) end end end |