Class: Harmony::Service::Utils::Secrets

Inherits:
Object
  • Object
show all
Defined in:
lib/harmony/service/utils/secrets.rb

Class Method Summary collapse

Class Method Details

.loadObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/harmony/service/utils/secrets.rb', line 8

def self.load 
  env = ENV['HARMONY_ENV']
  abort "ENV['HARMONY_ENV'] must be set." unless env
     
  sekrets_file_path = "./config/#{env}.yml.enc"
  if File.exist?(sekrets_file_path)
    puts "Reading secrets from file: #{sekrets_file_path}"
    secrets = Sekrets.settings_for(sekrets_file_path)
    secrets.each_pair{|k,v| ENV[k] = v.to_s } 
  else
    warn "Secrets file doesn't exist: #{sekrets_file_path}"
  end
end