From 074cd7138efdee15e3bd97aae9816f56701c8c84 Mon Sep 17 00:00:00 2001 From: fumimowdan Date: Wed, 13 Sep 2023 15:38:11 +0100 Subject: [PATCH] Renamed env var GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID to GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID --- .env.example | 1 + .github/workflows/build-and-deploy.yml | 2 +- .github/workflows/ci.yml | 2 +- Dockerfile | 4 ++-- app/mailers/govuk_notify_mailer.rb | 2 +- config/application.rb | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 523920bb..1c574d12 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ PORT=3000 GOVUK_NOTIFY_API_KEY= GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID= +GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID= AZURE_CLIENT_ID= AZURE_CLIENT_SECRET= AZURE_TENANT_ID= diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 7c58ce4e..fc1cd50a 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -89,7 +89,7 @@ jobs: COMMIT_SHA=${{ env.IMAGE_TAG }} GOVUK_NOTIFY_API_KEY=${{ secrets.GOVUK_NOTIFY_API_KEY }} GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID=${{ secrets.GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID }} - GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID=${{ secrets.GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID }} + GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID=${{ secrets.GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID }} - name: Push ${{ env.DOCKER_IMAGE }} images for review if: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24d8f5a3..92810f6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: DATABASE_URL: 'postgres://rails:password@localhost:5432/rails_test' GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID: ${{ secrets.GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID }} - GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID: ${{ secrets.GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID }} + GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID: ${{ secrets.GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID }} steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/Dockerfile b/Dockerfile index bac235a8..36229831 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,8 +41,8 @@ ENV GOVUK_NOTIFY_API_KEY=$GOVUK_NOTIFY_API_KEY ARG GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID ENV GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID=$GOVUK_NOTIFY_APPLICATION_SUBMITTED_TEMPLATE_ID -ARG GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID -ENV GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID=$GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID +ARG GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID +ENV GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID=$GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID CMD bundle exec rails db:migrate && \ bundle exec rails server -b 0.0.0.0 diff --git a/app/mailers/govuk_notify_mailer.rb b/app/mailers/govuk_notify_mailer.rb index 86fad95e..a3495a13 100644 --- a/app/mailers/govuk_notify_mailer.rb +++ b/app/mailers/govuk_notify_mailer.rb @@ -2,7 +2,7 @@ class GovukNotifyMailer < Mail::Notify::Mailer def application_submission @urn = params[:urn] view_mail( - Rails.configuration.x.govuk_notify.mail_notify_template_id, + Rails.configuration.x.govuk_notify.generic_email_template_id, to: params[:email], subject: t("mailer.application_submission.subject"), ) diff --git a/config/application.rb b/config/application.rb index d0c1226d..ef38132e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -47,6 +47,6 @@ class Application < Rails::Application api_key: ENV.fetch("GOVUK_NOTIFY_API_KEY"), } - config.x.govuk_notify.mail_notify_template_id = ENV.fetch("GOVUK_NOTIFY_MAIL_NOTIFY_TEMPLATE_ID") + config.x.govuk_notify.generic_email_template_id = ENV.fetch("GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID") end end