feat: allow overriding smtp_password with the LEMMY_SMTP_PASSWORD env var (#3154)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
pull/3208/head
Michał 2023-06-21 19:36:42 +02:00 committed by GitHub
parent 3775418952
commit 4cdb9583e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -78,7 +78,11 @@ pub fn send_email(
};
// Set the creds if they exist
if let (Some(username), Some(password)) = (email_config.smtp_login, email_config.smtp_password) {
let smtp_password = std::env::var("LEMMY_SMTP_PASSWORD")
.ok()
.or(email_config.smtp_password);
if let (Some(username), Some(password)) = (email_config.smtp_login, smtp_password) {
builder = builder.credentials(Credentials::new(username, password));
}