diff --git a/config/application.rb b/config/application.rb index 41909fd943d..e1fcc3928bc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -164,6 +164,15 @@ class Application < Rails::Application Vmdb::Loggers.apply_config(::Settings.log) end + initializer :eager_load_all_the_things, :after => :load_config_initializers do + if ENV['DEBUG_MANAGEIQ_ZEITWERK'].present? + config.eager_load_paths += config.autoload_paths + Vmdb::Plugins.each do |plugin| + plugin.config.eager_load_paths += plugin.config.autoload_paths + end + end + end + config.after_initialize do Vmdb::Initializer.init ActiveRecord::Base.connection_pool.release_connection diff --git a/config/initializers/zeitwerk.rb b/config/initializers/zeitwerk.rb index 16f9b068120..1e46e9d8e41 100644 --- a/config/initializers/zeitwerk.rb +++ b/config/initializers/zeitwerk.rb @@ -1,4 +1,9 @@ if Rails.application.config.autoloader == :zeitwerk && Rails.autoloaders.main + if ENV['DEBUG_MANAGEIQ_ZEITWERK'].present? + Zeitwerk::Loader.default_logger = method(:puts) + Rails.autoloaders.main.logger = Logger.new($stdout) + end + # These specific directories are for code organization, not namespacing: # TODO: these should be either renamed with good names, the intermediate directory removed # and/or both.