Sha256: a6e5de1ddce29fac84ba5737b3a9888f6e71188d9cf9a2c1a390227cdb5a3910

Contents?: true

Size: 806 Bytes

Versions: 10

Compression:

Stored size: 806 Bytes

Contents

require 'roo_on_rails/rack/populate_env_from_jwt'

module RooOnRails
  module Railties
    class RooIdentity < Rails::Railtie
      initializer 'roo_on_rails.roo_identity.middleware' do |app|
        Rails.logger.with initializer: 'roo_on_rails.roo_identity' do |log|
          if RooOnRails::Rack::PopulateEnvFromJWT.configured?
            log.debug 'loading'
            _add_middleware(app, log)
          else
            log.warn 'not configured, roo.identity will be unavailable'
          end
        end
      end

      private

      def _add_middleware(app, log)
        app.config.middleware.use RooOnRails::Rack::PopulateEnvFromJWT, logger: log
      rescue LoadError
        log.error 'the json-jwt gem is not in the bundle so Roo Identity will not be available'
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roo_on_rails-2.0.0.pre.pre.2 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-2.0.0.pre.pre.1 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.22.0 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.21.0 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.20.0 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.19.0 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.18.0 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.17.0 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.16.2 lib/roo_on_rails/railties/roo_identity.rb
roo_on_rails-1.16.1 lib/roo_on_rails/railties/roo_identity.rb