diff --git a/EnvelopeGenerator.Application/Configurations/EnvelopeReceiverCacheParams.cs b/EnvelopeGenerator.Application/Configurations/EnvelopeReceiverCacheParams.cs
deleted file mode 100644
index 5d51941a..00000000
--- a/EnvelopeGenerator.Application/Configurations/EnvelopeReceiverCacheParams.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace EnvelopeGenerator.Application.Configurations
-{
- public class EnvelopeReceiverCacheParams
- {
- ///
- /// Gets the cache key format for SMS codes.
- /// The placeholder {0} represents the envelopeReceiverId.
- ///
- public string CodeCacheKeyFormat { get; init; } = "sms-code-{0}";
-
- ///
- /// Gets the cache expiration key format for SMS codes.
- /// The placeholder {0} represents the envelopeReceiverId.
- ///
- public string CodeExpirationCacheKeyFormat { get; init; } = "sms-code-expiration-{0}";
- }
-}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Application/Extensions/DIExtensions.cs b/EnvelopeGenerator.Application/Extensions/DIExtensions.cs
index 2a81c47a..4ece3817 100644
--- a/EnvelopeGenerator.Application/Extensions/DIExtensions.cs
+++ b/EnvelopeGenerator.Application/Extensions/DIExtensions.cs
@@ -16,7 +16,7 @@ namespace EnvelopeGenerator.Application.Extensions
{
public static class DIExtensions
{
- public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfigurationSection dispatcherConfigSection, IConfigurationSection mailConfigSection, IConfigurationSection smsConfigSection, IConfigurationSection codeGeneratorConfigSection, IConfigurationSection envelopeReceiverCacheParamsSection, IConfigurationSection totpSmsParamsSection)
+ public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration config)
{
//Inject CRUD Service and repositoriesad
services.TryAddScoped();
@@ -54,13 +54,12 @@ namespace EnvelopeGenerator.Application.Extensions
services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly);
services.AddAutoMapper(typeof(UserMappingProfile).Assembly);
- services.Configure(dispatcherConfigSection);
- services.Configure(mailConfigSection);
- services.Configure(codeGeneratorConfigSection);
- services.Configure(envelopeReceiverCacheParamsSection);
- services.Configure(totpSmsParamsSection);
+ services.ConfigureByTypeName(config);
+ services.ConfigureByTypeName(config);
+ services.ConfigureByTypeName(config);
+ services.ConfigureByTypeName(config);
- services.AddHttpClientService(smsConfigSection);
+ services.AddHttpClientService(config.GetSection(nameof(SmsParams)));
services.TryAddSingleton();
services.TryAddSingleton();
services.TryAddSingleton();
@@ -69,12 +68,8 @@ namespace EnvelopeGenerator.Application.Extensions
return services;
}
- public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration config) => services.AddEnvelopeGenerator(
- dispatcherConfigSection: config.GetSection("DispatcherConfig"),
- mailConfigSection: config.GetSection("MailConfig"),
- smsConfigSection: config.GetSection("SmsConfig"),
- codeGeneratorConfigSection: config.GetSection("CodeGeneratorParams"),
- envelopeReceiverCacheParamsSection: config.GetSection("EnvelopeReceiverCacheParams"),
- totpSmsParamsSection: config.GetSection("TotpSmsParams"));
+ //TODO: move to DigitalData.Core
+ private static IServiceCollection ConfigureByTypeName(this IServiceCollection services, IConfiguration configuration) where TOptions : class
+ => services.Configure(configuration.GetSection(nameof(TOptions)));
}
}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs
index 974206eb..abf5afff 100644
--- a/EnvelopeGenerator.Web/Controllers/HomeController.cs
+++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs
@@ -23,6 +23,7 @@ using EnvelopeGenerator.Application.Extensions;
using Microsoft.Extensions.Caching.Distributed;
using System.Globalization;
using Microsoft.Extensions.Options;
+using EnvelopeGenerator.Application.Configurations;
namespace EnvelopeGenerator.Web.Controllers
{
diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json
index 500b55c1..05320652 100644
--- a/EnvelopeGenerator.Web/appsettings.json
+++ b/EnvelopeGenerator.Web/appsettings.json
@@ -124,7 +124,7 @@
"GTXMessagingConfig": {
"AuthKey": "ep$?A!Gs"
},
- "SmsConfig": {
+ "SmsParams": {
"Uri": "https://rest.gtx-messaging.net",
"Path": "smsc/sendsms/f566f7e5-bdf2-4a9a-bf52-ed88215a432e/json",
"Headers": {},