Sha256: 9cab0c0c0faaae2180c277887717f775d4abfa7e542d7dc15e6945d3eded51a7

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

module Runger # :nodoc:
  DEFAULT_CONFIGS_PATH = "config/configs"

  class Railtie < ::Rails::Railtie # :nodoc:
    # Add settings to Rails config
    config.runger_config = Runger::Settings

    config.before_configuration do
      next if ::Rails.application.initialized?
      config.runger_config.autoload_static_config_path = DEFAULT_CONFIGS_PATH
    end

    config.before_eager_load do
      Runger::Settings.autoloader&.eager_load
    end

    # Remove `autoload_static_config_path` from Rails `autoload_paths`
    # since we use our own autoloading mechanism
    initializer "runger_config.cleanup_autoload" do
      Runger::Settings.cleanup_autoload_paths
    end

    # Make sure loaders are not changed in runtime
    config.after_initialize { Runger.loaders.freeze }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
runger_config-4.0.0 lib/runger/railtie.rb