From dbb69f1290ed7c83fb1b495c1b6855ea357b6ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilien=20Pressens=C3=A9?= Date: Mon, 18 Nov 2024 22:09:59 +0100 Subject: [PATCH] update deploy steps to use RAILS_MASTER_KEY --- .github/workflows/ci.yml | 1 + config/initializers/mailjet.rb | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd36ed6..52484bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,6 +96,7 @@ jobs: - name: Run tests env: + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} RAILS_ENV: test # REDIS_URL: redis://localhost:6379/0 run: bin/rails db:test:prepare test test:system diff --git a/config/initializers/mailjet.rb b/config/initializers/mailjet.rb index f4f87ce..4b46d2b 100644 --- a/config/initializers/mailjet.rb +++ b/config/initializers/mailjet.rb @@ -1,12 +1,15 @@ # kindly generated by appropriated Rails generator -Mailjet.configure do |config| - config.api_key = Rails.application.credentials.mailjet[:api_key] - config.secret_key = Rails.application.credentials.mailjet[:secret_key] - config.default_from = "contact@benefactorum.org" - # Mailjet API v3.1 is at the moment limited to Send API. - # We’ve not set the version to it directly since there is no other endpoint in that version. - # We recommend you create a dedicated instance of the wrapper set with it to send your emails. - # If you're only using the gem to send emails, then you can safely set it to this version. - # Otherwise, you can remove the dedicated line into config/initializers/mailjet.rb. - config.api_version = "v3.1" + +if Rails.application.credentials.mailjet.present? + Mailjet.configure do |config| + config.api_key = Rails.application.credentials.mailjet.api_key + config.secret_key = Rails.application.credentials.mailjet.secret_key + config.default_from = "contact@benefactorum.org" + # Mailjet API v3.1 is at the moment limited to Send API. + # We’ve not set the version to it directly since there is no other endpoint in that version. + # We recommend you create a dedicated instance of the wrapper set with it to send your emails. + # If you're only using the gem to send emails, then you can safely set it to this version. + # Otherwise, you can remove the dedicated line into config/initializers/mailjet.rb. + config.api_version = "v3.1" + end end