Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix boolean parsing of SMTP configuration from environment variables. #5861

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

Aadesh-Baral
Copy link
Contributor

@Aadesh-Baral Aadesh-Baral commented Jun 1, 2023

In the previous implementation, there was an issue with parsing the boolean values of the SMTP configuration from environment variables. The use of bool() on the string returned by os.getenv() caused both MAIL_USE_TLS and MAIL_USE_SSL to be set to True, regardless of the actual environment variable values.

This PR fixes the issue with boolean parsing. By explicitly converting the environment variable values to integers using int() and providing default string values of "1" for TM_SMTP_USE_TLS and "0" for TM_SMTP_USE_SSL, the correct boolean values are obtained. This ensures that the SMTP configuration reflects the intended TLS and SSL settings based on the environment variables provided.

With this fix, the MAIL_USE_TLS and MAIL_USE_SSL variables will be set to True only if the environment variables are set to non-zero values, and False otherwise.

-------------------------------------------------
In the previous implementation, there was an issue with parsing the boolean values of the SMTP configuration from environment variables. The use of bool() on the string returned by os.getenv() caused both MAIL_USE_TLS and MAIL_USE_SSL to be set to True, regardless of the actual environment variable values.
@sonarcloud
Copy link

sonarcloud bot commented Jun 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Aadesh-Baral Aadesh-Baral merged commit e0f524b into develop Jun 1, 2023
8 checks passed
@Aadesh-Baral Aadesh-Baral deleted the fix/mail-env-configs branch June 1, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant