Sha256: cff868548392b4f0aeb46beb22c2e42f7329d45c9fe066b3febe9b916b47763e

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

class Recipes::RackCors < Rails::AppBuilder
  def install
    create
  end

  def create
    gather_gem('rack-cors', '~> 0.4.0')
    after(:gem_install) do
      rack_cors_config =
        <<~RUBY
          config.middleware.insert_before 0, Rack::Cors do
            allow do
              origins '*'
              resource '*',
                headers: :any,
                expose: ['X-Page', 'X-PageTotal'],
                methods: [:get, :post, :delete, :put, :options]
            end
          end

        RUBY

      application rack_cors_config
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
potassium-5.2.3 lib/potassium/recipes/rack_cors.rb
potassium-5.2.2 lib/potassium/recipes/rack_cors.rb
potassium-5.2.1 lib/potassium/recipes/rack_cors.rb
potassium-5.2.0 lib/potassium/recipes/rack_cors.rb