Sha256: 438116738015aa4de24f29ce8805d8d8037681452f9ad244ed2a435ec910b22e

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

require 'rails/engine'

module GoogleSignIn
  class Engine < ::Rails::Engine
    isolate_namespace GoogleSignIn

    config.google_sign_in = ActiveSupport::OrderedOptions.new

    initializer 'google_sign_in.config' do |app|
      config.after_initialize do
        GoogleSignIn.client_id     = config.google_sign_in.client_id || app.credentials.dig(:google_sign_in, :client_id)
        GoogleSignIn.client_secret = config.google_sign_in.client_secret || app.credentials.dig(:google_sign_in, :client_secret)
      end
    end

    initializer 'google_sign_in.helpers' do
      ActiveSupport.on_load :action_controller_base do
        helper GoogleSignIn::Engine.helpers
      end
    end

    initializer 'google_sign_in.mount' do |app|
      app.routes.append do
        mount GoogleSignIn::Engine, at: app.config.google_sign_in.root || 'google_sign_in'
      end
    end

    initializer 'google_sign_in.parameter_filters' do |app|
      app.config.filter_parameters << :code
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
google_sign_in-1.1.0 lib/google_sign_in/engine.rb
google_sign_in-1.0.2 lib/google_sign_in/engine.rb
google_sign_in-1.0.1 lib/google_sign_in/engine.rb