Sha256: fcb98054dbc82f4e8d49ec2f9f839588beb0a488e6feee276635339fedb52687

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

module Legion
  module Crypt
    module Settings
      def self.default
        {
          vault: vault,
          cs_encrypt_ready: false,
          dynamic_keys: true,
          cluster_secret: nil,
          save_private_key: true,
          read_private_key: true
        }
      end

      def self.vault
        {
          enabled: !Gem::Specification.find_by_name('vault').nil?,
          protocol: 'http',
          address: 'localhost',
          port: 8200,
          token: ENV['VAULT_DEV_ROOT_TOKEN_ID'] || ENV['VAULT_TOKEN_ID'] || nil,
          connected: false,
          renewer_time: 5,
          renewer: true,
          push_cluster_secret: true,
          read_cluster_secret: true,
          kv_path: ENV['LEGION_VAULT_KV_PATH'] || 'legion'
        }
      end
    end
  end
end

begin
  Legion::Settings.merge_settings('crypt', Legion::Crypt::Settings.default) if Legion.const_defined?('Settings')
rescue StandardError => e
  if Legion.const_defined?('Logging') && Legion::Logging.method_defined?(:fatal)
    Legion::Logging.fatal(e.message)
    Legion::Logging.fatal(e.backtrace)
  else
    puts e.message
    puts e.backtrace
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
legion-crypt-1.2.0 lib/legion/crypt/settings.rb
legion-crypt-0.3.0 lib/legion/crypt/settings.rb