Sha256: b324f7d2c50bdb53d4dea896056b084aabb1b580ddc439d5ce68624f34d29b8b

Contents?: true

Size: 1.94 KB

Versions: 25

Compression:

Stored size: 1.94 KB

Contents

require 'secure_headers'
require_relative './secure_headers'

module CoalescingPanda
  class Engine < ::Rails::Engine
    config.autoload_once_paths += Dir["#{config.root}/lib/**/"]
    isolate_namespace CoalescingPanda

    config.generators do |g|
      g.test_framework :rspec
      g.fixture_replacement :factory_girl, :dir => 'spec/factories'
    end

    initializer :append_migrations do |app|
      unless app.root.to_s.match root.to_s
        config.paths["db/migrate"].expanded.each do |expanded_path|
          app.config.paths["db/migrate"] << expanded_path
        end
      end
    end

    initializer 'coalescing_panda.app_controller' do |app|
      OAUTH_10_SUPPORT = true
      ActiveSupport.on_load(:action_controller) do
        include CoalescingPanda::ControllerHelpers
      end
    end

    initializer 'coalescing_panda.assets' do |app|
      app.config.assets.precompile << 'coalescing_panda/manifest.js'
    end

    initializer 'cloaescing_panda.route_helper' do |route|
      ActionDispatch::Routing::Mapper.send :include, CoalescingPanda::RouteHelpers
    end

    initializer 'coalescing_panda.route_options', :after => :disable_dependency_loading do |app|
      ActiveSupport.on_load(:action_controller) do
        #force the routes to load
        Rails.application.reload_routes!
        CoalescingPanda::propagate_lti_navigation
      end
    end

    initializer :secure_headers do |app|
      begin
        ::SecureHeaders::Configuration.default do |config|
          CoalescingPanda::SecureHeaders.apply_defaults(config)
        end
      rescue ::SecureHeaders::Configuration::AlreadyConfiguredError
        # The App already applied settings
      end

      ::SecureHeaders::Configuration.override(:safari_override) do |config|
        config.cookies = SecureHeaders::OPT_OUT
      end

      ::SecureHeaders::Configuration.override(:allow_inline_scripts) do |config|
        config.csp[:script_src] << "'unsafe-inline'"
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
coalescing_panda-5.2.2.beta1 lib/coalescing_panda/engine.rb
coalescing_panda-5.2.1 lib/coalescing_panda/engine.rb
coalescing_panda-5.2.0 lib/coalescing_panda/engine.rb
coalescing_panda-5.2.0.beta2 lib/coalescing_panda/engine.rb
coalescing_panda-5.2.0.beta1 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.13 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.12 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.11 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.10 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.9 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.8 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.7 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.6 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.5 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.4 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.3.beta.2 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.3.beta.1 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.3 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.2 lib/coalescing_panda/engine.rb
coalescing_panda-5.1.0 lib/coalescing_panda/engine.rb