Permalink
Browse files

Revised strategy loading a bit

  • Loading branch information...
1 parent b293bc6 commit 76c14de7a001f41c217a0df9d204194f736de0c8 @Slotos committed Jun 22, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/casserver/server.rb
View
@@ -225,13 +225,21 @@ def self.handler_ssl_options
end
end
- def self.init_matchers!
+ def self.init_strategies!
return nil unless config[:strategy]
config[:strategy].each do |name, conf|
set :workhorse, conf
- require ( conf[:require] || "rubycas-strategy-#{name}" )
- register ( conf[:register] || "CASServer::Strategy::#{name.capitalize}".constantize )
+
+ begin
+ require ( conf[:require] || "rubycas-strategy-#{name}" )
+ rescue LoadError => e
+ $LOG.warning "Failed require with error #{e}, attempting to load #{name} strategy anyway"
+ end
+
+ strategy = ( conf[:register] || "CASServer::Strategy::#{name.capitalize}" ).constantize
+ register strategy
+
set :workhorse, nil
end
@@ -333,7 +341,7 @@ def self.init_database!
init_logger!
init_database!
init_authenticators!
- init_matchers!
+ init_strategies!
end
before do

0 comments on commit 76c14de

Please sign in to comment.