Skip to content

Conversation

giamma1295
Copy link
Contributor

@giamma1295 giamma1295 commented Oct 13, 2025

Override MailerConfig with other MailUp Auth Config for validation email flow.

List of Changes

  • Added getValidationEmailMailerConfig function, which implements the override logic for Validation Email Mailer Configuration.
  • Added optional ENVs to override the MailUp account to be used for sending validation emails.
  • Init 2 dedicated MailerTransporter, one for each Mail we sent (Login and Validation Email), instead a global one.
  • Unit Test for getValidationEmailMailerConfig.

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a changeset, which I've added.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link

changeset-bot bot commented Oct 13, 2025

🦋 Changeset detected

Latest commit: 5ba891a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
io-profile Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 13, 2025

Jira Pull Request Link

This Pull Request refers to the following Jira issue IOPID-3459

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for overriding MailUp configuration specifically for validation emails by adding optional environment variables and configuration handling to use different MailUp credentials for validation emails while keeping the existing credentials for other email types.

  • Adds optional override environment variables for MailUp credentials in validation email flow
  • Implements configuration logic to create separate mailer transporters for login and validation emails
  • Updates function calls to use the appropriate mailer transporter based on email type

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
infra/resources/prod/function_profile.tf Adds optional override environment variables for MailUp validation email credentials
apps/io-profile/src/main.ts Creates separate mailer transporters and updates function calls to use appropriate transporter
apps/io-profile/src/config.ts Implements configuration logic to handle MailUp credential overrides for validation emails

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

Copy link
Contributor

Tip

✅ All Terraform module locks are up to date

No module changes detected - everything is in sync!

📋 Pre-commit Output Log
[INFO] Initializing environment for https://github.com/pagopa/dx.
[INFO] Initializing environment for https://github.com/antonbabenko/pre-commit-terraform.
Lock Terraform Registry modules..........................................Passed
Terraform validate with tflint...........................................Passed
Terraform fmt............................................................Passed
terraform_docs on resources..............................................Passed
Terraform validate.......................................................Passed
Terraform validate with trivy........................(no files to check)Skipped

Generated on Tue Oct 14 08:28:49 UTC 2025
Run all checks on modified files

@giamma1295 giamma1295 changed the title WIP: [#IOPID-3459] ovveride MailerConfig for ValidationEmail [#IOPID-3459] ovveride MailerConfig for ValidationEmail Oct 14, 2025
@giamma1295 giamma1295 marked this pull request as ready for review October 14, 2025 08:42
@giamma1295 giamma1295 requested review from a team as code owners October 14, 2025 08:42
Copy link
Contributor

Tip

✅ All Terraform module locks are up to date

No module changes detected - everything is in sync!

📋 Pre-commit Output Log
[INFO] Initializing environment for https://github.com/pagopa/dx.
[INFO] Initializing environment for https://github.com/antonbabenko/pre-commit-terraform.
Lock Terraform Registry modules..........................................Passed

Generated on Tue Oct 14 08:44:10 UTC 2025
Run lock_modules on folder: infra/resources/prod/

Copy link

Copy link
Contributor

📖 Terraform Plan (infra/resources/prod) - success

Show Plan
  # module.function_profile.azurerm_linux_function_app.this will be updated in-place
  ~ resource "azurerm_linux_function_app" "this" {
      ~ app_settings                                   = {
          + "OVERRIDE_MAILUP_SECRET_VALIDATION_EMAIL"                                                          = (sensitive value)
          + "OVERRIDE_MAILUP_USERNAME_VALIDATION_EMAIL"                                                        = (sensitive value)
            # (44 unchanged elements hidden)
        }
        id                                             = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-itn-auth-main-rg-01/providers/Microsoft.Web/sites/io-p-itn-auth-profile-func-02"
        name                                           = "io-p-itn-auth-profile-func-02"
        tags                                           = {
            "CostCenter"                                     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"                                      = "Terraform"
            "Environment"                                    = "Prod"
            "ManagementTeam"                                 = "IO Auth&Identity"
            "ModuleName"                                     = "azure_function_app"
            "ModuleSource"                                   = "DX"
            "ModuleVersion"                                  = "1.0.1"
            "Owner"                                          = "IO"
            "Source"                                         = "https://github.com/pagopa/io-auth-n-identity-domain/tree/main/infra/resources/prod"
        }
        # (33 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # module.function_profile.azurerm_linux_function_app_slot.this[0] will be updated in-place
  ~ resource "azurerm_linux_function_app_slot" "this" {
      ~ app_settings                                   = {
          + "OVERRIDE_MAILUP_SECRET_VALIDATION_EMAIL"                                                          = (sensitive value)
          + "OVERRIDE_MAILUP_USERNAME_VALIDATION_EMAIL"                                                        = (sensitive value)
            # (45 unchanged elements hidden)
        }
        id                                             = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-itn-auth-main-rg-01/providers/Microsoft.Web/sites/io-p-itn-auth-profile-func-02/slots/staging"
        name                                           = "staging"
        tags                                           = {
            "CostCenter"     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "IO Auth&Identity"
            "ModuleName"     = "azure_function_app"
            "ModuleSource"   = "DX"
            "ModuleVersion"  = "1.0.1"
            "Owner"          = "IO"
            "Source"         = "https://github.com/pagopa/io-auth-n-identity-domain/tree/main/infra/resources/prod"
        }
        # (31 unchanged attributes hidden)

      ~ site_config {
          ~ health_check_eviction_time_in_min             = 0 -> 2
            # (33 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant