Browse Source

Fix action mailer on gov paas (#153)

* Set action mailer host to env vars

* Inject env var

* Fix template

* Single env var
pull/155/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
2e0d0bfd7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/pipeline.yml
  2. 4
      app/views/devise/mailer/_password_change_initial.html.erb
  3. 2
      config/environments/production.rb
  4. 2
      config/environments/sandbox.rb

2
.github/workflows/pipeline.yml

@ -106,6 +106,7 @@ jobs:
APP_NAME: dluhc-core APP_NAME: dluhc-core
CORE_EMAIL_USERNAME: ${{ secrets.CORE_EMAIL_USERNAME }} CORE_EMAIL_USERNAME: ${{ secrets.CORE_EMAIL_USERNAME }}
CORE_EMAIL_PASSWORD: ${{ secrets.CORE_EMAIL_PASSWORD }} CORE_EMAIL_PASSWORD: ${{ secrets.CORE_EMAIL_PASSWORD }}
APP_HOST: ${{ secrets.APP_HOST }}
run: | run: |
cf7 api $CF_API_ENDPOINT cf7 api $CF_API_ENDPOINT
cf7 auth cf7 auth
@ -114,4 +115,5 @@ jobs:
cf7 set-env $APP_NAME API_KEY $API_KEY cf7 set-env $APP_NAME API_KEY $API_KEY
cf7 set-env $APP_NAME CORE_EMAIL_USERNAME $CORE_EMAIL_USERNAME cf7 set-env $APP_NAME CORE_EMAIL_USERNAME $CORE_EMAIL_USERNAME
cf7 set-env $APP_NAME CORE_EMAIL_PASSWORD $CORE_EMAIL_PASSWORD cf7 set-env $APP_NAME CORE_EMAIL_PASSWORD $CORE_EMAIL_PASSWORD
cf7 set-env $APP_NAME APP_HOST $APP_HOST
cf7 push --strategy rolling cf7 push --strategy rolling

4
app/views/devise/mailer/_password_change_initial.html.erb

@ -1,6 +1,6 @@
<p>Hello <%= @resource.name %>!</p> <p>Hello <%= @resource.name %>!</p>
<p>An account has been created for you to submit CORE data on behalf of @resource.organisation.</p> <p>An account has been created for you to submit CORE data on behalf of <%= @resource.organisation %>.</p>
<p>Your username is <% @resource.email %>, use the link below to set your password. <p>Your username is <%= @resource.email %>, use the link below to set your password.
<p><%= govuk_link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p> <p><%= govuk_link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>

2
config/environments/production.rb

@ -58,6 +58,8 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: ENV['APP_HOST'], port: 3000 }
# Ignore bad email addresses and do not raise email delivery errors. # 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. # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false

2
config/environments/sandbox.rb

@ -58,6 +58,8 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: ENV['APP_HOST'], port: 3000 }
# Ignore bad email addresses and do not raise email delivery errors. # 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. # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false

Loading…
Cancel
Save