Project

General

Profile

« Previous | Next » 

Revision d88d3472

Added by Marc Dequènes almost 14 years ago

  • ID d88d3472827afe9bb3f71efd4ff3c8f6f1f6c682

[fix] improve LDAP config loading, and add connection testing

View differences:

bin/postman
Config.load(self.human_name.downcase)
@config = Config.instance
ldap_config = @config.ldap
ldap_config.logger = logger
ActiveLdap::Base.setup_connection(ldap_config.marshal_dump)
# setup logs
unless @config.log.nil?
logger.output_level(@config.log.console_level) unless @config.log.console_level.nil?
......
end
end
# setup LDAP
ldap_config = @config.ldap.marshal_dump
ldap_config[:logger] = logger
begin
ActiveLdap::Base.setup_connection(ldap_config)
# force testing a connection NOW (by default ActiveLdap is doing lazy connections)
# (the loaded schema will be useful soon anyway)
# it also tests search parameters (provided to setup_connection)
ActiveLdap::Base.find(:first)
rescue
logger.fatal "LDAP failure: " + $!
exit 1
end
@imap = IMAP.new(@config.imap, @config.imap.min_check_interval)
logger.info "Bot '#{self.human_name}' loaded"

Also available in: Unified diff