Skip to content

chore: use env var to config email address#742

Open
LucasCharrier wants to merge 1 commit intomasterfrom
task/api-change-email
Open

chore: use env var to config email address#742
LucasCharrier wants to merge 1 commit intomasterfrom
task/api-change-email

Conversation

@LucasCharrier
Copy link
Contributor

No description provided.

@revu-bot revu-bot bot requested a review from revu-bot February 10, 2026 17:07
Copy link
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

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

Summary

This PR refactors hardcoded email configuration values into environment variables, improving configurability across different environments. The changes are straightforward and follow good practices for externalizing configuration.

Key Observations

Aspect Status Notes
Configuration externalization ✅ Good Email addresses now configurable via env vars
Backward compatibility ✅ Good Default values provided as fallbacks
Security ⚠️ Minor concern Email addresses exposed in .env.example

Issues Found

  1. IMPORTANT: Inconsistent email domain between default values
  2. MINOR: Missing newline at end of .env.example file

The overall implementation is solid, but there's a critical inconsistency in the default email domain that needs attention.

Comment on lines +31 to +32
export const MAIL_DEFAULT_EMAIL = process.env.MAIL_DEFAULT_EMAIL || "jardinmental@assurance-maladie.fr";
export const MAIL_DEFAULT_NAME = process.env.MAIL_DEFAULT_NAME || "Jardin Mental - Application";
Copy link
Collaborator

Choose a reason for hiding this comment

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

[IMPORTANT] Inconsistent email domain in defaults

Why it matters:

  • The default values use @assurance-maladie.fr domain
  • The original hardcoded values throughout the codebase used @fabrique.social.gouv.fr domain
  • This changes the default behavior when env vars are not set, potentially breaking existing deployments
  • Emails may be sent to/from the wrong domain in environments that don't explicitly set these variables

Proposed change:
Either:

  1. Keep the original domain as the default for backward compatibility, OR
  2. Document this breaking change clearly and ensure all environments set these variables explicitly

If option 1 (recommended for safety):

Comment on lines +9 to +10
MAIL_DEFAULT_EMAIL=jardinmental@assurance-maladie.fr
MAIL_DEFAULT_NAME=Jardin Mental - Application No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

[MINOR] Missing newline at end of file

Why it matters:

  • POSIX standard requires text files to end with a newline
  • Can cause issues with some tools and version control systems
  • Git will show "No newline at end of file" warning

Proposed change:
Add a newline character after the last line.

Comment on lines +9 to +10
MAIL_DEFAULT_EMAIL=jardinmental@assurance-maladie.fr
MAIL_DEFAULT_NAME=Jardin Mental - Application No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

[IMPORTANT] Verify intended email domain change

Why it matters:

  • The example shows @assurance-maladie.fr domain
  • Previous hardcoded values used @fabrique.social.gouv.fr domain
  • This appears to be an intentional domain migration, but should be verified

Action required:
Confirm this domain change is intentional and update documentation if this represents a migration from one email provider/domain to another. If unintentional, align with the original domain.

@sonarqubecloud
Copy link

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.

2 participants