Sha256: 1c57a0999bd799a5ff6cd5a519440f1a2bdd3e45f629eb517062cf9f0dd2428d

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

require 'elasticonf'

module ElasticonfRails
  class Railtie < Rails::Railtie
    ActiveSupport.on_load :before_configuration do
      Elasticonf.configure do |config|
        config.env = Rails.env.to_s
        config.config_root = Rails.root.join('config')
      end

      Rails.root.join('config', 'initializers', 'elasticonf.rb').tap do |initializer|
        require initializer if File.exist?(initializer)
      end
      
      Elasticonf.load!
    end

    if Rails.env.development? || Rails.env.test?
      initializer 'elasticonf.reloader' do |app|
        # Middleware that reloads Elasticonf on every request
        app.middleware.use ElasticonfRails::Reloader
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elasticonf-rails-1.0.0 lib/elasticonf_rails/railtie.rb