Module: SymmetricEncryption::Config

Defined in:
lib/symmetric_encryption/config.rb

Class Method Summary collapse

Class Method Details

.load!(filename = nil, environment = nil) ⇒ Object

Load the Encryption Configuration from a YAML file

filename:
  Name of file to read.
      Mandatory for non-Rails apps
      Default: Rails.root/config/symmetric-encryption.yml
environment:
  Which environments config to load. Usually: production, development, etc.
  Default: Rails.env


11
12
13
14
15
16
17
18
# File 'lib/symmetric_encryption/config.rb', line 11

def self.load!(filename=nil, environment=nil)
  config  = read_config(filename, environment)
  ciphers = extract_ciphers(config)

  SymmetricEncryption.cipher            = ciphers.shift
  SymmetricEncryption.secondary_ciphers = ciphers
  true
end