Sha256: 88280289250836008e4a2c9053dfe70ef8d435340154cb579a2225e1ad3596e6

Contents?: true

Size: 1.11 KB

Versions: 24

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module Rimless
  # Rails-specific initializations.
  class Railtie < Rails::Railtie
    # Run before all Rails initializers, but after the application is defined
    config.before_initialize do
      conf = Rimless.configuration
      app_name = Rimless.local_app_name

      # Reset the default application name (which is +nil+), because the Rails
      # application was not defined when the rimless gem was loaded
      conf.app_name = app_name

      # Set the app name as default client id, when not already set
      conf.client_id ||= app_name
    end

    # Run after all configuration is set via Rails initializers
    config.after_initialize do
      # Reconfigure our dependencies
      Rimless.configure_dependencies

      # Load the Karafka application inside the Sidekiq server application
      if defined? Sidekiq
        Sidekiq.configure_server do
          Rimless.consumer.initialize!
        end
      end
    end

    # Load all our Rake tasks if we're supposed to do
    rake_tasks do
      Dir[File.join(__dir__, 'tasks', '*.rake')].each { |file| load file }
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rimless-1.8.0 lib/rimless/railtie.rb
rimless-1.7.7 lib/rimless/railtie.rb
rimless-1.7.6 lib/rimless/railtie.rb
rimless-1.7.5 lib/rimless/railtie.rb
rimless-1.7.4 lib/rimless/railtie.rb
rimless-1.7.3 lib/rimless/railtie.rb
rimless-1.7.2 lib/rimless/railtie.rb
rimless-1.7.1 lib/rimless/railtie.rb
rimless-1.7.0 lib/rimless/railtie.rb
rimless-1.6.0 lib/rimless/railtie.rb
rimless-1.5.1 lib/rimless/railtie.rb
rimless-1.5.0 lib/rimless/railtie.rb
rimless-1.4.2 lib/rimless/railtie.rb
rimless-1.4.1 lib/rimless/railtie.rb
rimless-1.4.0 lib/rimless/railtie.rb
rimless-1.3.0 lib/rimless/railtie.rb
rimless-1.2.0 lib/rimless/railtie.rb
rimless-1.1.1 lib/rimless/railtie.rb
rimless-1.1.0 lib/rimless/railtie.rb
rimless-1.0.4 lib/rimless/railtie.rb