Class: Kamal::Cli::Secrets
Constant Summary
Constants inherited from Base
Base::AUTOMATIC_DEPLOY_LOCK_MESSAGE, Base::VERBOSITY
Instance Method Summary collapse
Methods inherited from Base
dynamic_command_class, exit_on_failure?, #initialize
Constructor Details
This class inherits a constructor from Kamal::Cli::Base
Instance Method Details
#extract(name, secrets) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/kamal/cli/secrets.rb', line 22 def extract(name, secrets) parsed_secrets = JSON.parse(secrets) value = parsed_secrets[name] || parsed_secrets.find { |k, v| k.end_with?("/#{name}") }&.last raise "Could not find secret #{name}" if value.nil? return_or_puts value, inline: [:inline] end |
#fetch(*secrets) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/kamal/cli/secrets.rb', line 7 def fetch(*secrets) adapter = initialize_adapter([:adapter]) if adapter.requires_account? && [:account].blank? return puts "No value provided for required options '--account'" end results = adapter.fetch(secrets, **.slice(:account, :from).symbolize_keys) json = JSON.dump(results) return_or_puts [:inline] ? json.shellescape : json, inline: [:inline] end |
#print ⇒ Object
32 33 34 35 36 |
# File 'lib/kamal/cli/secrets.rb', line 32 def print KAMAL.config.secrets.to_h.each do |key, value| puts "#{key}=#{value}" end end |