lib/legion/crypt.rb in legion-crypt-0.2.1 vs lib/legion/crypt.rb in legion-crypt-0.2.2
- old
+ new
@@ -12,19 +12,27 @@
class << self
attr_reader :sessions
include Legion::Crypt::Cipher
- if Legion::Settings[:crypt][:vault][:enabled]
+ unless Gem::Specification.find_by_name('vault').nil?
require 'legion/crypt/vault'
include Legion::Crypt::Vault
end
def start
Legion::Logging.debug 'Legion::Crypt is running start'
- # load_keys if Dir.exist?('./settings') && File.exist?('./settings/private.key') && File.exist?('./settings/public.key')
+ ::File.write('./legionio.key', private_key) if settings[:save_private_key]
- # connect_vault unless Legion::Settings[:crypt][:vault][:token].nil?
+ connect_vault unless settings[:vault][:token].nil?
+ end
+
+ def settings
+ if Legion.const_defined?('Settings')
+ Legion::Settings[:crypt]
+ else
+ Legion::Crypt::Settings.default
+ end
end
def shutdown
shutdown_renewer
close_sessions