inject MediatRLicense
This commit is contained in:
parent
dc7da91872
commit
dd5babfdbe
@ -37,7 +37,11 @@ try
|
|||||||
// Add services to the container
|
// Add services to the container
|
||||||
var cnn_str = config.GetConnectionString("Default") ?? throw new("Default connection string not found.");
|
var cnn_str = config.GetConnectionString("Default") ?? throw new("Default connection string not found.");
|
||||||
builder.Services.AddDbContext<WFDBContext>(options => options.UseSqlServer(cnn_str).EnableDetailedErrors());
|
builder.Services.AddDbContext<WFDBContext>(options => options.UseSqlServer(cnn_str).EnableDetailedErrors());
|
||||||
builder.Services.AddWorkFlowServices().AddWorkFlowRepositories().AddUserManager<WFDBContext>();
|
var mediatRLicense = config["MediatRLicense"]
|
||||||
|
?? throw new InvalidOperationException(
|
||||||
|
"The 'MediatRLicense' configuration value is missing or empty." +
|
||||||
|
"Please ensure it is properly set in the configuration source.");
|
||||||
|
builder.Services.AddWorkFlowServices(opt => opt.MediatRLicense = mediatRLicense).AddWorkFlowRepositories().AddUserManager<WFDBContext>();
|
||||||
builder.Services.AddCookieBasedLocalizer();
|
builder.Services.AddCookieBasedLocalizer();
|
||||||
builder.Services.AddDirectorySearchService(config.GetSection("DirectorySearchOptions"));
|
builder.Services.AddDirectorySearchService(config.GetSection("DirectorySearchOptions"));
|
||||||
builder.Services.AddJWTService<UserReadDto>(user => new SecurityTokenDescriptor()
|
builder.Services.AddJWTService<UserReadDto>(user => new SecurityTokenDescriptor()
|
||||||
|
|||||||
@ -80,5 +80,6 @@
|
|||||||
"AuthClientParams": {
|
"AuthClientParams": {
|
||||||
"Url": "http://172.24.12.39:9090/auth-hub",
|
"Url": "http://172.24.12.39:9090/auth-hub",
|
||||||
"RetryDelay": "00:00:05"
|
"RetryDelay": "00:00:05"
|
||||||
}
|
},
|
||||||
|
"MediatRLicense": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ikx1Y2t5UGVubnlTb2Z0d2FyZUxpY2Vuc2VLZXkvYmJiMTNhY2I1OTkwNGQ4OWI0Y2IxYzg1ZjA4OGNjZjkiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2x1Y2t5cGVubnlzb2Z0d2FyZS5jb20iLCJhdWQiOiJMdWNreVBlbm55U29mdHdhcmUiLCJleHAiOiIxNzg0ODUxMjAwIiwiaWF0IjoiMTc1MzM2MjQ5MSIsImFjY291bnRfaWQiOiIwMTk4M2M1OWU0YjM3MjhlYmZkMzEwM2MyYTQ4NmU4NSIsImN1c3RvbWVyX2lkIjoiY3RtXzAxazB5NmV3MmQ4YTk4Mzg3aDJnbTRuOWswIiwic3ViX2lkIjoiLSIsImVkaXRpb24iOiIwIiwidHlwZSI6IjIifQ.ZqsFG7kv_-xGfxS6ACk3i0iuNiVUXX2AvPI8iAcZ6-z2170lGv__aO32tWpQccD9LCv5931lBNLWSblKS0MT3gOt-5he2TEftwiSQGFwoIBgtOHWsNRMinUrg2trceSp3IhyS3UaMwnxZDrCvx4-0O-kpOzVpizeHUAZNr5U7oSCWO34bpKdae6grtM5e3f93Z1vs7BW_iPgItd-aLvPwApbaG9VhmBTKlQ7b4Jh64y7UXJ9mKP7Qb_Oa97oEg0oY5DPHOWTZWeE1EzORgVr2qkK2DELSHuZ_EIUhODojkClPNAKtvEl_qEjpq0HZCIvGwfCCRlKlSkQqIeZdFkiXg"
|
||||||
}
|
}
|
||||||
@ -7,8 +7,11 @@ namespace WorkFlow.Application;
|
|||||||
|
|
||||||
public static class DependencyInjection
|
public static class DependencyInjection
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services)
|
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services, Action<DIOptions>? options = null)
|
||||||
{
|
{
|
||||||
|
DIOptions diOptions = new();
|
||||||
|
options?.Invoke(diOptions);
|
||||||
|
|
||||||
services.AddAutoMapper(typeof(MappingProfile).Assembly);
|
services.AddAutoMapper(typeof(MappingProfile).Assembly);
|
||||||
services.TryAddScoped<IConfigService, ConfigService>();
|
services.TryAddScoped<IConfigService, ConfigService>();
|
||||||
services.TryAddScoped<IProfileControlsTFService, ProfileControlsTFService>();
|
services.TryAddScoped<IProfileControlsTFService, ProfileControlsTFService>();
|
||||||
@ -18,8 +21,14 @@ public static class DependencyInjection
|
|||||||
services.AddMediatR(cfg =>
|
services.AddMediatR(cfg =>
|
||||||
{
|
{
|
||||||
cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
|
cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
|
||||||
|
cfg.LicenseKey = diOptions.MediatRLicense;
|
||||||
});
|
});
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DIOptions
|
||||||
|
{
|
||||||
|
public string MediatRLicense { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user