Sha256: 91a80e05dcf98073d9d7cba7618a07d272d170ab7282009ed395554dd7b33ca4

Contents?: true

Size: 957 Bytes

Versions: 2

Compression:

Stored size: 957 Bytes

Contents

require 'cartoset'
require 'rails'
require 'warden'
require 'rails_warden'

require 'cartoset/auth/omniauth_cartodb_authentication'
require 'cartoset/auth/warden_strategies'


module Cartoset
  class Engine < Rails::Engine

    initializer "static assets" do |app|
      app.middleware.use ::ActionDispatch::Static, "#{root}/public"
    end

    initializer "cartoset.add_middleware" do

      config.app_middleware.use RailsWarden::Manager do |manager|
        manager.default_strategies :cartodb_oauth
        manager.failure_app = SessionsController if defined?(SessionsController)
      end

      host = oauth_key = oauth_secret = nil
      if CartoDB.const_defined?('Settings')
        host = CartoDB::Settings['host']
        oauth_key = CartoDB::Settings['oauth_key']
        oauth_secret = CartoDB::Settings['oauth_secret']
      end
      config.app_middleware.use OmniAuth::Strategies::Cartodb, host, oauth_key, oauth_secret

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cartoset-0.0.2 lib/engine.rb
cartoset-0.0.1 lib/engine.rb