Sha256: 7f9dd1765c68fd45b2878ac8d09dd01b30918263ec01e5dc95425df628dc0821

Contents?: true

Size: 615 Bytes

Versions: 71

Compression:

Stored size: 615 Bytes

Contents

module Kontena::Cli::Vault
  class ExportCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    banner "Exports secrets from Vault to STDOUT as YAML or JSON."

    requires_current_master

    option '--json', :flag, "Output JSON"

    def execute
      require 'shellwords'
      require 'json'
      require 'yaml'
      meth = json? ? :to_json : :to_yaml
      puts(
        Kontena.run!(['vault', 'ls', '--return']).sort.map do |secret|
          [secret, Kontena.run!(['vault', 'read', '--return', secret])]
        end.to_h.send(meth)
      )
    end
  end
end

Version data entries

71 entries across 71 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/cli/vault/export_command.rb
krates-1.7.10 lib/kontena/cli/vault/export_command.rb
krates-1.7.9 lib/kontena/cli/vault/export_command.rb
krates-1.7.8 lib/kontena/cli/vault/export_command.rb
krates-1.7.7 lib/kontena/cli/vault/export_command.rb
krates-1.7.6 lib/kontena/cli/vault/export_command.rb
krates-1.7.5 lib/kontena/cli/vault/export_command.rb
krates-1.7.4 lib/kontena/cli/vault/export_command.rb
krates-1.7.3 lib/kontena/cli/vault/export_command.rb
krates-1.7.2 lib/kontena/cli/vault/export_command.rb
krates-1.7.1 lib/kontena/cli/vault/export_command.rb
krates-1.7.0 lib/kontena/cli/vault/export_command.rb
krates-1.6.9 lib/kontena/cli/vault/export_command.rb
krates-1.6.8 lib/kontena/cli/vault/export_command.rb
krates-1.6.7 lib/kontena/cli/vault/export_command.rb
krates-1.6.6 lib/kontena/cli/vault/export_command.rb
krates-1.6.5 lib/kontena/cli/vault/export_command.rb
krates-1.6.4 lib/kontena/cli/vault/export_command.rb
krates-1.6.3 lib/kontena/cli/vault/export_command.rb
krates-1.6.2 lib/kontena/cli/vault/export_command.rb