Class: Kamal::Cli::Secrets
- Inherits:
-
Base
- Object
- Thor
- Base
- Kamal::Cli::Secrets
show all
- Defined in:
- lib/kamal/cli/secrets.rb
Instance Method Summary
collapse
Methods inherited from Base
dynamic_command_class, exit_on_failure?, #initialize
Instance Method Details
21
22
23
24
25
26
27
28
|
# File 'lib/kamal/cli/secrets.rb', line 21
def (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: options[:inline]
end
|
#fetch(*secrets) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/kamal/cli/secrets.rb', line 7
def fetch(*secrets)
adapter = initialize_adapter(options[:adapter])
if adapter.requires_account? && options[:account].blank?
return puts "No value provided for required options '--account'"
end
results = adapter.fetch(secrets, **options.slice(:account, :from).symbolize_keys)
return_or_puts JSON.dump(results).shellescape, inline: options[:inline]
end
|
#print ⇒ Object
31
32
33
34
35
|
# File 'lib/kamal/cli/secrets.rb', line 31
def print
KAMAL.config.secrets.to_h.each do |key, value|
puts "#{key}=#{value}"
end
end
|