|
1 | 1 | gsub_file! "config/environments/production.rb", |
2 | | - "# config.assets.css_compressor = :sass", |
3 | | - <<-RUBY |
4 | | - # |
5 | | - # Currently disabled as minification adds a *huge* amount of time to precompile, |
6 | | - # and gzip alone already gets us about 70% of the benefits of minify+gzip |
7 | | - config.assets.css_compressor = false |
8 | | -RUBY |
| 2 | + "config.assume_ssl = true", |
| 3 | + <<~RUBY |
| 4 | + # |
| 5 | + # You should never use this because it just blindly sets headers without any actual |
| 6 | + # checks; instead, whatever is handling the SSL-termination should be setting the |
| 7 | + # appropriate headers to indicate that the request was actually SSL-terminated. |
| 8 | + config.assume_ssl = false |
| 9 | + RUBY |
9 | 10 |
|
10 | 11 | gsub_file! "config/environments/production.rb", |
11 | 12 | "config.force_ssl = true", |
12 | 13 | <<~RUBY |
13 | | - ## |
14 | | - # `force_ssl` defaults to on. Set `force_ssl` to false if (and only if) RAILS_FORCE_SSL=false, otherwise set it to true. |
15 | 14 | # |
| 15 | + # On by default, though can be disabled by setting RAILS_FORCE_SSL=false (and only "false") |
16 | 16 | config.force_ssl = ENV.fetch("RAILS_FORCE_SSL", "true").downcase != "false" |
17 | 17 | RUBY |
18 | 18 |
|
19 | 19 | gsub_file! "config/environments/production.rb", |
20 | 20 | "# config.action_mailer.raise_delivery_errors = false", |
21 | | - <<-RUBY |
22 | | - config.action_mailer.raise_delivery_errors = true |
| 21 | + "config.action_mailer.raise_delivery_errors = true" |
23 | 22 |
|
24 | | - config.action_mailer.default_url_options = { |
25 | | - host: "#{TEMPLATE_CONFIG.production_hostname}", |
26 | | - protocol: "https" |
27 | | - } |
28 | | - config.action_mailer.asset_host = "https://#{TEMPLATE_CONFIG.production_hostname}" |
| 23 | +gsub_file! "config/environments/production.rb", |
| 24 | + 'config.action_mailer.default_url_options = { host: "example.com" }', |
| 25 | + <<~RUBY |
| 26 | + config.action_mailer.default_url_options = { |
| 27 | + host: "#{TEMPLATE_CONFIG.production_hostname}", |
| 28 | + protocol: "https" |
| 29 | + } |
29 | 30 |
|
| 31 | + config.action_mailer.asset_host = "https://#{TEMPLATE_CONFIG.production_hostname}" |
| 32 | + RUBY |
| 33 | +gsub_file! "config/environments/production.rb", |
| 34 | + <<-RUBY, |
| 35 | + # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. |
| 36 | + # config.action_mailer.smtp_settings = { |
| 37 | + # user_name: Rails.application.credentials.dig(:smtp, :user_name), |
| 38 | + # password: Rails.application.credentials.dig(:smtp, :password), |
| 39 | + # address: "smtp.example.com", |
| 40 | + # port: 587, |
| 41 | + # authentication: :plain |
| 42 | + # } |
| 43 | + RUBY |
| 44 | + <<-RUBY |
| 45 | + # Specify outgoing SMTP server. |
30 | 46 | config.action_mailer.smtp_settings = { |
31 | 47 | address: ENV.fetch("SMTP_HOSTNAME"), |
32 | 48 | port: ENV.fetch("SMTP_PORT", 587), |
|
43 | 59 | 'ENV.fetch("RAILS_LOG_LEVEL", ENV.fetch("LOG_LEVEL", "info"))' |
44 | 60 |
|
45 | 61 | gsub_file! "config/environments/production.rb", |
46 | | - "ActiveSupport::Logger.new(STDOUT)", |
47 | | - "ActiveSupport::Logger.new($stdout)" |
48 | | - |
49 | | -insert_into_file! "config/environments/production.rb", |
50 | | - after: /.*config\.public_file_server\.enabled.*\n/ do |
51 | | - <<~'RUBY' |
| 62 | + "ActiveSupport::TaggedLogging.logger(STDOUT)", |
| 63 | + "ActiveSupport::TaggedLogging.logger($stdout)" |
52 | 64 |
|
53 | | - # Ensure that Rails sets appropriate caching headers on static assets if |
54 | | - # Rails is serving static assets in production e.g. on Heroku |
55 | | - # |
56 | | - # Overview of Cache-control values: |
57 | | - # |
58 | | - # max-age=<seconds> |
59 | | - # The maximum amount of time a resource is considered fresh. |
60 | | - # |
61 | | - # s-maxage=<seconds> |
62 | | - # Overrides max-age or the Expires header, but only for shared |
63 | | - # caches (e.g., proxies). Ignored by private caches. |
64 | | - # |
65 | | - # More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control |
66 | | - # |
67 | | - # Our Cache-Control header: |
68 | | - # |
69 | | - # * It tells all caches (both proxies like Cloudflare and the users web |
70 | | - # browser) that the asset can be cached. |
71 | | - # * It tells shared caches (e.g. Cloudflare) that they can cache it for 365 days |
72 | | - # * It tells browsers that they should cache for 365 days |
73 | | - # |
74 | | - # Cloudflare will respect s-maxage if it is set so change that value if you |
75 | | - # want Cloudflare to cache differently than then browser. |
76 | | - # |
77 | | - config.public_file_server.headers = { |
78 | | - "Cache-Control" => "public, s-maxage=#{365.days.seconds}, max-age=#{365.days.seconds}" |
79 | | - } |
80 | | -
|
81 | | - RUBY |
82 | | -end |
| 65 | +gsub_file! "config/environments/production.rb", |
| 66 | + "config.silence_healthcheck_path =", |
| 67 | + "# config.silence_healthcheck_path =" |
83 | 68 |
|
84 | 69 | insert_into_file! "config/environments/production.rb", |
85 | 70 | after: /.*config.cache_store = :mem_cache_store\n/ do |
|
0 commit comments