-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use a safer gsub_file
and update/remove file gsubs that were no longer doing anything
#533
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,14 @@ | |
RUBY | ||
end | ||
|
||
gsub_file "config/environments/production.rb", | ||
"# config.force_ssl = true", | ||
<<~RUBY | ||
## | ||
# `force_ssl` defaults to on. Set `force_ssl` to false if (and only if) RAILS_FORCE_SSL=false, otherwise set it to true. | ||
# | ||
config.force_ssl = ENV.fetch("RAILS_FORCE_SSL", "true").downcase != "false" | ||
RUBY | ||
gsub_file! "config/environments/production.rb", | ||
"config.force_ssl = true", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Rails 7.1 now ships with this just enabled, but I think it's worth us keeping an env variable for toggling it just in case |
||
<<~RUBY | ||
## | ||
# `force_ssl` defaults to on. Set `force_ssl` to false if (and only if) RAILS_FORCE_SSL=false, otherwise set it to true. | ||
# | ||
config.force_ssl = ENV.fetch("RAILS_FORCE_SSL", "true").downcase != "false" | ||
RUBY | ||
|
||
insert_into_file "config/environments/production.rb", | ||
after: /# config\.action_mailer\.raise_deliv.*\n/ do | ||
|
@@ -42,13 +42,13 @@ | |
RUBY | ||
end | ||
|
||
gsub_file "config/environments/production.rb", | ||
"config.log_level = :info", | ||
'config.log_level = ENV.fetch("LOG_LEVEL", "info").to_sym' | ||
gsub_file! "config/environments/production.rb", | ||
'ENV.fetch("RAILS_LOG_LEVEL", "info")', | ||
'ENV.fetch("RAILS_LOG_LEVEL", ENV.fetch("LOG_LEVEL", "info"))' | ||
|
||
gsub_file "config/environments/production.rb", | ||
"ActiveSupport::Logger.new(STDOUT)", | ||
"ActiveSupport::Logger.new($stdout)" | ||
gsub_file! "config/environments/production.rb", | ||
"ActiveSupport::Logger.new(STDOUT)", | ||
"ActiveSupport::Logger.new($stdout)" | ||
|
||
insert_into_file "config/environments/production.rb", | ||
after: /.*config\.public_file_server\.enabled.*\n/ do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,9 @@ | |
copy_file "variants/backend-base/config/initializers/check_env.rb", "config/initializers/check_env.rb" | ||
copy_file "variants/backend-base/config/initializers/sentry.rb", "config/initializers/sentry.rb" | ||
|
||
gsub_file "config/initializers/filter_parameter_logging.rb", /\[:password\]/ do | ||
"%w[password secret session cookie csrf]" | ||
end | ||
gsub_file! "config/initializers/filter_parameter_logging.rb", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: this relates to #529 - technically I've fixed this gsub so we're now adding to the existing values, but we still want to re-review our options |
||
/ {2}:passw, :secret, /, | ||
" :passw, :secret, :session, :cookie, :csrf, " | ||
|
||
apply "variants/backend-base/config/environments/development.rb" | ||
apply "variants/backend-base/config/environments/production.rb" | ||
|
@@ -59,7 +59,7 @@ | |
EO_ROUTES | ||
|
||
if File.exist? "config/storage.yml" | ||
gsub_file "config/storage.yml", /# service: S3/ do | ||
gsub_file! "config/storage.yml", /# service: S3/ do | ||
<<~YAML | ||
# service: S3 | ||
# upload: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this is no longer matching because of the quotes, but Rubocop can automatically fix this anyway now