OnePassword, LastPass + Bitwarden adapters

This commit is contained in:
Donal McBreen
2024-08-29 15:11:04 +01:00
parent 79731da619
commit 9ade79fc84
3 changed files with 62 additions and 36 deletions

View File

@@ -2,9 +2,12 @@ class Kamal::Cli::Secrets < Kamal::Cli::Base
desc "fetch [ITEM] [FIELDS...]", "Fetch secrets from a vault"
option :adapter, type: :string, aliases: "-a", required: true, desc: "Which vault adapter to use"
option :account, type: :string, aliases: "-a", required: true, desc: "The account identifier or username"
def fetch(item, *fields)
option :location, type: :string, aliases: "-a", required: false, desc: "A vault or folder to fetch the secrets from"
def fetch(*secrets)
ENV["KAMAL_SECRETS_KILL_PARENT"] = "1"
puts JSON.dump(adapter(options[:adapter]).fetch(item, fields, account: options[:account])).shellescape
results = adapter(options[:adapter]).fetch(secrets, **options.slice(:account, :location).symbolize_keys)
puts JSON.dump(results).shellescape
end
desc "extract", "Extract a single secret from the results of a fetch call"