Skip to content

Commit

Permalink
feat: Sender email is not loaded from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaneu committed Jan 8, 2024
1 parent e6b61ef commit 192bb13
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion function/Service/UserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down Expand Up @@ -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"}
}
}, {
Expand Down

0 comments on commit 192bb13

Please sign in to comment.