Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Sender email is not loaded from configuration
Browse files Browse the repository at this point in the history
cmaneu committed Jan 8, 2024

Verified

This commit was signed with the committer’s verified signature.
bonjourmauko Mauko Quiroga-Alvarado
1 parent e6b61ef commit 1f89c4e
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions function/Service/IConfigurationService.cs
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ public class ConfigurationServiceWellKnownKeys
public const string MailjetApiKey = nameof(MailjetApiKey);
public const string MailjetApiSecret = nameof(MailjetApiSecret);
public const string BaseFunctionUrl = nameof(BaseFunctionUrl);
public const string MailjetSenderEmail = nameof(MailjetSenderEmail);
}

public class EnvironmentConfigurationService : IConfigurationService
4 changes: 3 additions & 1 deletion function/Service/UserService.cs
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ internal class UserService : IUserService
private readonly string _jwtTokenKey;
private readonly string _mailJetApiKey;
private readonly string _mailjetApiSecret;
private readonly string _mailjetSenderEmail;
private string _functionBaseUrl;

// TODO This is a hack. We should have something like a "FilesystemService"
@@ -47,6 +48,7 @@ public UserService(IUserStore userStore, IConfigurationService configurationServ
_mailJetApiKey = configurationService.GetValue(ConfigurationServiceWellKnownKeys.MailjetApiKey);
_mailjetApiSecret = configurationService.GetValue(ConfigurationServiceWellKnownKeys.MailjetApiSecret);
_functionBaseUrl = configurationService.GetValue(ConfigurationServiceWellKnownKeys.BaseFunctionUrl);
_mailjetSenderEmail = configurationService.GetValue(ConfigurationServiceWellKnownKeys.MailjetSenderEmail);
}

public async Task<User> Register(string lastName, string firstName, string birthYear, string email,
@@ -203,7 +205,7 @@ private async Task SendEmail(string to, string content, string textContent, stri
{
"From",
new JObject {
{"Email", "[email protected]"},
{"Email", _mailjetSenderEmail},
{"Name", "Surfrider"}
}
}, {

0 comments on commit 1f89c4e

Please sign in to comment.