* Add dual booting logic to Gemfile This might be helpful for the Rails 6.0 upgrade project. * Add more than one gemfile to Travis' configuration We want to see how the application behaves with more than one Rails versions: - Gemfile -> Rails 5.2 - Gemfile.next -> Rails 6.0 This will help us figure out what needs to be addressed before migrating to Rails 6.0. If you want to read more about this technique (dual booting) you can check out this page: https://www.fastruby.io/blog/upgrade-rails/dual-boot/dual-boot-with-rails-6-0-beta.html * Fix joins * Upgrade Gemfile.next.lock * Make sure we're installing the correct versions of gems * Add Rails 6 notes * Update rubocop in Gemfile.next.lock * Fix organization spec * Fix page_views_spec * Add Rails 6 and run rails app:update * Remove some tricks * Remove Gemfile.next for now * Fix .content_type deprecation * Fix deprecation of .where.not NAND/NOR behavior * Fix deprecation of parameterized emails * Fix specs * Remove next flag for now * Fix spec (hopefully) * Add wait_for_javascript * Fix spec, thanks @maestromac! * Try without wait for javascript hack * Remove unnecessary bin/update * Remove file that snuck in the rebase * Update the vendored gems * Replace migrate+db:setup with db:prepare * Update vendored gems * Fix Gemfile.lock and update vendored stuff * Fix Gemfile.lock to be the same as master's minus the changes Co-authored-by: rhymes <rhymesete@gmail.com>
19 lines
957 B
Ruby
19 lines
957 B
Ruby
# Be sure to restart your server when you modify this file.
|
|
|
|
# Enable CORS for API v0 (logging is only activated when debug is enabled)
|
|
debug_cors = ENV["DEBUG_CORS"].present? ? true : false
|
|
Rails.application.config.middleware.insert_before 0, Rack::Cors, debug: debug_cors, logger: (-> { Rails.logger }) do
|
|
allow do
|
|
origins do |source, _env|
|
|
source # echo back the client's `Origin` header instead of using `*`
|
|
end
|
|
|
|
# allowed public APIs
|
|
%w[articles comments listings podcast_episodes tags users videos].each do |resource_name|
|
|
# allow read operations, disallow custom headers (eg. api-key) and enable preflight caching
|
|
# NOTE: Chrome caps preflight caching at 2 hours, Firefox at 24 hours
|
|
# see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age#Directives
|
|
resource "/api/#{resource_name}/*", methods: %i[head get options], headers: [], max_age: 2.hours.to_i
|
|
end
|
|
end
|
|
end
|