Skip to content

Commit

Permalink
Revert "rails upgrade override origin (#1165)" (#1166)
Browse files Browse the repository at this point in the history
This reverts commit 80af53c.
  • Loading branch information
GcioGregg authored Jun 13, 2024
1 parent 80af53c commit 83dbcf7
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 141 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

gem 'rails', '7.1.3.4'
gem 'rails', '7.0.8.1'

gem 'active_model_serializers', '~> 0.10.14' # JSON API
gem 'activerecord-import' # Mass importing of CSV data
Expand Down Expand Up @@ -42,7 +42,7 @@ gem 'sentry-raven', '~> 3.1.2'
gem 'sitemap_generator'
gem 'sprockets-rails' # Rails 7 upgrade - needed for now.
gem 'strong_migrations'
gem 'terser'
gem 'uglifier', '>= 1.3.0'
gem 'vets_json_schema', git: 'https://github.com/department-of-veterans-affairs/vets-json-schema', branch: 'master'
gem 'virtus', '~> 2.0.0'
gem 'will_paginate'
Expand Down
166 changes: 69 additions & 97 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,69 +18,64 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rails-dom-testing (~> 2.0)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.4)
actionpack (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.14)
actionpack (>= 4.1)
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.3.6)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
timeout (>= 0.4.0)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activerecord-import (1.6.0)
activerecord (>= 4.2)
activerecord-session_store (2.1.0)
Expand All @@ -90,21 +85,17 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 4)
railties (>= 6.1)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activesupport (= 7.1.3.4)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
marcel (~> 1.0)
activesupport (7.1.3.4)
base64
bigdecimal
mini_mime (>= 1.1.0)
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
Expand Down Expand Up @@ -145,7 +136,6 @@ GEM
concurrent-ruby (1.3.1)
config (5.4.0)
deep_merge (~> 1.2, >= 1.2.1)
connection_pool (2.4.1)
crass (1.0.6)
csv (3.3.0)
database_cleaner (2.0.2)
Expand Down Expand Up @@ -235,10 +225,6 @@ GEM
i18n (1.14.5)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
io-console (0.7.2)
irb (1.13.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand Down Expand Up @@ -314,36 +300,29 @@ GEM
method_source (~> 1.0)
pry-nav (1.0.0)
pry (>= 0.9.10, < 0.15)
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
rack (3.0.11)
rack (2.2.9)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
actionmailer (= 7.1.3.4)
actionpack (= 7.1.3.4)
actiontext (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activemodel (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
bundler (>= 1.15.0)
railties (= 7.1.3.4)
railties (= 7.0.8.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -355,24 +334,19 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
rackup (>= 1.0.0)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
method_source
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.2)
reline (0.5.9)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
Expand Down Expand Up @@ -488,20 +462,19 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stringio (3.1.1)
strong_migrations (1.8.0)
activerecord (>= 5.2)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
terser (1.2.3)
execjs (>= 0.3.0, < 3)
thor (1.3.1)
thread_safe (0.3.6)
tilt (2.1.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
vcr (6.2.0)
virtus (2.0.0)
Expand All @@ -518,7 +491,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand Down Expand Up @@ -576,7 +548,7 @@ DEPENDENCIES
puma (~> 6.4.2)
rack (>= 2.2.8.1)
rack-cors
rails (= 7.1.3.4)
rails (= 7.0.8.1)
rails-controller-testing
rails-html-sanitizer (>= 1.4.4)
rainbow
Expand All @@ -597,7 +569,7 @@ DEPENDENCIES
spring
sprockets-rails
strong_migrations
terser
uglifier (>= 1.3.0)
vcr (~> 6.2)
vets_json_schema!
virtus (~> 2.0.0)
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
before_action :override_origin_header

# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
Expand Down Expand Up @@ -42,11 +40,4 @@ def alert_and_log(message, error = nil)
Rails.logger.error message + error&.backtrace.to_s
flash[:danger] = message
end

private

def override_origin_header
request.headers['Origin'] = 'http://staging.va.gov:443' if request.headers['Origin'] == 'https://staging.va.gov'
request.headers['Origin'] = 'http://www.va.gov:443' if request.headers['Origin'] == 'https://www.va.gov'
end
end
10 changes: 2 additions & 8 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative 'boot'
require File.expand_path('../boot', __FILE__)

require 'rails/all'

Expand All @@ -10,11 +10,6 @@ module GibctDataService
class Application < Rails::Application
config.load_defaults '7.0' # enables zeitwerk mode in CRuby

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))

# Configuration for the application, engines, and railties goes here.
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
Expand Down Expand Up @@ -47,7 +42,6 @@ class Application < Rails::Application

# Rails 7 upgrade - turn off warnings
# https://stackoverflow.com/questions/76347365/how-do-i-set-legacy-connection-handling-to-false-in-my-rails-application
# the legacy_connection_handling configuration option, which was deprecated in Rails 7.0 and removed in Rails 7.1
# config.active_record.legacy_connection_handling = false
config.active_record.legacy_connection_handling = false
end
end
3 changes: 0 additions & 3 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,4 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end
7 changes: 2 additions & 5 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
# this is the newer, best practice in Rails 7.1.3
config.enable_reloading = false
config.cache_classes = true

# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
Expand All @@ -28,7 +27,7 @@
# Compress JavaScripts and CSS.
# Do we want to switch to the Terser gem?
# https://stackoverflow.com/questions/75315372/when-running-rake-assetsprecompile-rails-env-production-over-es6-syntax-pipelin
config.assets.js_compressor = :terser
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
Expand Down Expand Up @@ -78,8 +77,6 @@
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "gibct_data_service_production"

config.action_mailer.perform_caching = false

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
Expand Down
Loading

0 comments on commit 83dbcf7

Please sign in to comment.