Sha256: 195070a2594fb8eb7371167aa96490cc2d3e3d8556c671d5beeafe00fb6f75bc
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require 'thor' module MuchKeys class CLI < Thor include Thor::Actions map %w[--version -v] => :__version class_option :consule_url, type: :string, default: 'http://localhost:8500' desc "encrypt FILE", "encrypt keys from a file to put in consul" method_option :public_key, type: :string, required: true def encrypt(file) say MuchKeysExecutor.encrypt(file, options[:public_key]) end desc "decrypt KEY", "decrypt keys from consul" method_option :public_key, type: :string, required: true method_option :private_key, type: :string, required: true def decrypt(consul_key) say MuchKeysExecutor.decrypt(consul_key, options[:public_key], options[:private_key]) end desc "fetch KEY", "fetch plaintext key from consul" def fetch(consul_key) say MuchKeysExecutor.fetch(consul_key) end desc "--version", "Print the version" def __version say MuchKeys::VERSION end module MuchKeysExecutor extend self def encrypt(file, public_key) string_to_encrypt = File.read(file) MuchKeys::Secret.encrypt_string(string_to_encrypt, public_key) end def decrypt(consul_key, public_key, private_key) MuchKeys.fetch_key(consul_key, public_key: public_key, private_key:private_key) end def fetch(consul_key) MuchKeys.fetch_key(consul_key) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
muchkeys-0.5.0 | lib/muchkeys/cli.rb |
muchkeys-0.4.0 | lib/muchkeys/cli.rb |