From b90bbdd87ae2ab1bf2c44af3fda4ad0199c1e8f1 Mon Sep 17 00:00:00 2001 From: rhymes Date: Sun, 13 Sep 2020 23:49:18 +0200 Subject: [PATCH] [deploy] Fix URL.domain in development by correctly loading authentication providers (#10296) --- app/services/authentication/providers.rb | 9 +++++++++ config/application.rb | 4 ++-- config/initializers/authentication.rb | 8 -------- 3 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 config/initializers/authentication.rb diff --git a/app/services/authentication/providers.rb b/app/services/authentication/providers.rb index db9602d99..247cffeca 100644 --- a/app/services/authentication/providers.rb +++ b/app/services/authentication/providers.rb @@ -1,3 +1,12 @@ +# We require all authentication modules to make sure providers +# are correctly preloaded and ready to be used at this point as the loading +# order is important +require_dependency Rails.root.join("app/services/authentication/providers/provider.rb") + +Dir[Rails.root.join("app/services/authentication/**/*.rb")].each do |f| + require_dependency(f) +end + module Authentication module Providers # Retrieves a provider that is both available and enabled diff --git a/config/application.rb b/config/application.rb index b64b08237..5fbab3654 100644 --- a/config/application.rb +++ b/config/application.rb @@ -45,8 +45,8 @@ module PracticalDeveloper config.eager_load_paths += Dir["#{config.root}/lib"] # Middlewares folder is not otherwise autorequired. - Dir["./app/middlewares/*.rb"].sort.each do |file| - require file + Dir["#{config.root}/app/middlewares/**/*.rb"].each do |file| + require_dependency(file) end config.active_job.queue_adapter = :sidekiq diff --git a/config/initializers/authentication.rb b/config/initializers/authentication.rb deleted file mode 100644 index 41d103fb7..000000000 --- a/config/initializers/authentication.rb +++ /dev/null @@ -1,8 +0,0 @@ -Rails.application.config.to_prepare do - # We require all authentication modules to make sure providers - # are correctly preloaded and ready to be used at this point as the loading - # order is important - Dir[Rails.root.join("app/services/authentication/**/*.rb")].each do |f| - require_dependency(f) - end -end