|
27 | 27 | config.force_ssl = ENV.fetch("RAILS_FORCE_SSL", "true").downcase != "false"
|
28 | 28 | RUBY
|
29 | 29 |
|
30 |
| -# TODO: it looks like these options are now spread across the config |
31 |
| -insert_into_file! "config/environments/production.rb", |
32 |
| - after: /# config\.action_mailer\.raise_deliv.*\n/ do |
33 |
| - <<-RUBY |
34 |
| -
|
35 |
| - # Production email config |
36 |
| - config.action_mailer.raise_delivery_errors = true |
37 |
| - config.action_mailer.default_url_options = { |
38 |
| - host: "#{TEMPLATE_CONFIG.production_hostname}", |
39 |
| - protocol: "https" |
40 |
| - } |
41 |
| - config.action_mailer.asset_host = "https://#{TEMPLATE_CONFIG.production_hostname}" |
| 30 | +gsub_file! "config/environments/production.rb", |
| 31 | + "# config.action_mailer.raise_delivery_errors = false", |
| 32 | + "config.action_mailer.raise_delivery_errors = true" |
42 | 33 |
|
43 |
| - config.action_mailer.smtp_settings = { |
44 |
| - address: ENV.fetch("SMTP_HOSTNAME"), |
45 |
| - port: ENV.fetch("SMTP_PORT", 587), |
46 |
| - enable_starttls_auto: true, |
47 |
| - user_name: ENV.fetch("SMTP_USERNAME"), |
48 |
| - password: ENV.fetch("SMTP_PASSWORD"), |
49 |
| - authentication: "login", |
50 |
| - domain: "#{TEMPLATE_CONFIG.production_hostname}" |
51 |
| - } |
| 34 | +gsub_file! "config/environments/production.rb", |
| 35 | + 'config.action_mailer.default_url_options = { host: "example.com" }', |
| 36 | + "config.action_mailer.default_url_options = { host: \"#{TEMPLATE_CONFIG.production_hostname}\", protocol: \"https\" }" |
52 | 37 |
|
53 |
| - RUBY |
54 |
| -end |
| 38 | +gsub_file! "config/environments/production.rb", |
| 39 | + <<~RUBY |
| 40 | + # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. |
| 41 | + # config.action_mailer.smtp_settings = { |
| 42 | + # user_name: Rails.application.credentials.dig(:smtp, :user_name), |
| 43 | + # password: Rails.application.credentials.dig(:smtp, :password), |
| 44 | + # address: "smtp.example.com", |
| 45 | + # port: 587, |
| 46 | + # authentication: :plain |
| 47 | + # } |
| 48 | + RUBY, |
| 49 | + <<-RUBY |
| 50 | + config.action_mailer.asset_host = "https://#{TEMPLATE_CONFIG.production_hostname}" |
| 51 | + config.action_mailer.smtp_settings = { |
| 52 | + address: ENV.fetch("SMTP_HOSTNAME"), |
| 53 | + port: ENV.fetch("SMTP_PORT", 587), |
| 54 | + enable_starttls_auto: true, |
| 55 | + user_name: ENV.fetch("SMTP_USERNAME"), |
| 56 | + password: ENV.fetch("SMTP_PASSWORD"), |
| 57 | + authentication: "login", |
| 58 | + domain: "#{TEMPLATE_CONFIG.production_hostname}" |
| 59 | + } |
| 60 | + RUBY |
55 | 61 |
|
56 | 62 | gsub_file! "config/environments/production.rb",
|
57 | 63 | 'ENV.fetch("RAILS_LOG_LEVEL", "info")',
|
|
0 commit comments