Module: PloneLogin::Credentials

Defined in:
lib/unipump/credentials.rb

Class Method Summary collapse

Class Method Details

.loadObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/unipump/credentials.rb', line 3

def self.load
  credentials  = {
    host: ENV['PLONE_LOGIN_HOST'],
    port: ENV['PLONE_LOGIN_PORT'],
    database: ENV['PLONE_LOGIN_DATABASE'],
    username: ENV['PLONE_LOGIN_USERNAME'],
    password: ENV['PLONE_LOGIN_PASSWORD']
  }

  credentials.each { |k,v| 
    next if [:port, :password].include?(k)
    !v.nil? or raise "Undefined connection parameter: #{k}. Please define PLONE_LOGIN_#{k.to_s.upcase}" 
  }

  credentials
end