lib/karafka/railtie.rb in karafka-2.0.28 vs lib/karafka/railtie.rb in karafka-2.0.29

- old
+ new

@@ -1,24 +1,17 @@ # frozen_string_literal: true # This file contains Railtie for auto-configuration -rails = false - -begin - # Do not load Rails again if already loaded - Object.const_defined?('Rails::Railtie') || require('rails') - - rails = true -rescue LoadError +unless Karafka.rails? # Without defining this in any way, Zeitwerk ain't happy so we do it that way module Karafka class Railtie end end end -if rails +if Karafka.rails? # Load ActiveJob adapter require 'active_job/karafka' # Setup env if configured (may be configured later by .net, etc) ENV['KARAFKA_ENV'] ||= ENV['RAILS_ENV'] if ENV.key?('RAILS_ENV')