Merge pull request #2896 from biosistemika/features/pwa

Merge features/pwa to develop
This commit is contained in:
Alex Kriuchykhin 2020-10-13 16:34:57 +02:00 committed by GitHub
commit d5499168f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 9 deletions

View file

@ -37,6 +37,7 @@ gem 'jsonapi-renderer', '~> 0.2.2'
gem 'jwt', '~> 1.5'
gem 'kaminari'
gem 'rack-attack'
gem 'rack-cors'
# JS datetime library, requirement of datetime picker
gem 'momentjs-rails', '~> 2.17.1'

View file

@ -410,6 +410,8 @@ GEM
rack (2.2.3)
rack-attack (6.1.0)
rack (>= 1.0, < 3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
@ -668,6 +670,7 @@ DEPENDENCIES
pry-rails
puma
rack-attack
rack-cors
rails (~> 6.0.0)
rails-controller-testing
rails_12factor

View file

@ -5,12 +5,22 @@
# Read more: https://github.com/cyu/rack-cors
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
# allow do
# origins 'example.com'
#
# resource '*',
# headers: :any,
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
# end
# end
if ENV['SCINOTE_PWA_DOMAIN_NAME'].present?
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins ENV['SCINOTE_PWA_DOMAIN_NAME']
resource '/oauth/token',
headers: :any,
methods: %i(post)
resource '/rails/active_storage/*',
headers: :any,
methods: %i(get post options head)
resource '/api/*',
headers: :any,
methods: %i(get post put patch delete options head)
end
end
end