Retructured solution
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
namespace LiteCharms.Features.Email.Extensions;
|
||||
|
||||
public static class Constants
|
||||
{
|
||||
public const string ShopSchedulerName = "shop";
|
||||
public const string ShopEmailFromName = "Khongisa Shop";
|
||||
public const string ShopEmailFromAddress = "shop@litecharms.co.za";
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace LiteCharms.Features.Email.Extensions;
|
||||
|
||||
public static class EmailTelemetry
|
||||
{
|
||||
public static readonly ActivitySource Source = new("LiteCharms.EmailService");
|
||||
public static readonly Meter Meter = new("LiteCharms.EmailService");
|
||||
public static readonly Counter<long> EmailsSent = Meter.CreateCounter<long>("emails_sent_total", "count", "Total successful emails sent");
|
||||
public static readonly Counter<long> EmailsFailed = Meter.CreateCounter<long>("emails_failed_total", "count", "Total failed email attempts");
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using LiteCharms.Features.Email.Configuration;
|
||||
|
||||
namespace LiteCharms.Features.Email.Extensions;
|
||||
|
||||
public static class Setup
|
||||
{
|
||||
public static IServiceCollection AddEmailServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.Configure<SmtpSettings>(configuration.GetSection("Email"));
|
||||
|
||||
services.AddSingleton<IEmailService, EmailService>();
|
||||
|
||||
services.AddOpenTelemetry()
|
||||
.WithTracing(tracing => tracing.AddSource("LiteCharms.EmailService"))
|
||||
.WithMetrics(metrics => metrics.AddMeter("LiteCharms.EmailService"));
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user