flatten configuration file structure

This commit is contained in:
cuqmbr 2025-05-29 12:24:13 +03:00
parent 9ccd0bb68d
commit 41158b34c5
Signed by: cuqmbr
GPG Key ID: 0AA446880C766199
7 changed files with 69 additions and 77 deletions

View File

@ -2,7 +2,7 @@ namespace cuqmbr.TravelGuide.Application;
public sealed class ConfigurationOptions public sealed class ConfigurationOptions
{ {
public static string SectionName { get; } = "Application"; public static string SectionName { get; } = "";
public LocalizationConfigurationOptions Localization { get; set; } = new(); public LocalizationConfigurationOptions Localization { get; set; } = new();

View File

@ -25,17 +25,14 @@ public static class Configuration
.AddCommandLine(args) .AddCommandLine(args)
.Build(); .Build();
services.AddOptions<PersistenceConfigurationOptions>().Bind( services.AddOptions<PersistenceConfigurationOptions>()
configuration.GetSection( .Bind(configuration);
PersistenceConfigurationOptions.SectionName));
services.AddOptions<ApplicationConfigurationOptions>().Bind( services.AddOptions<ApplicationConfigurationOptions>()
configuration.GetSection( .Bind(configuration);
ApplicationConfigurationOptions.SectionName));
services.AddOptions<InfrastructureConfigurationOptions>().Bind( services.AddOptions<InfrastructureConfigurationOptions>()
configuration.GetSection( .Bind(configuration);
InfrastructureConfigurationOptions.SectionName));
return services; return services;
} }

View File

@ -21,7 +21,10 @@ public static class Configuration
ExchangeApiCurrencyConverterService>() ExchangeApiCurrencyConverterService>()
.AddScoped< .AddScoped<
cuqmbr.TravelGuide.Application.Common.Services.LiqPayPaymentService, cuqmbr.TravelGuide.Application.Common.Services.LiqPayPaymentService,
cuqmbr.TravelGuide.Infrastructure.Services.LiqPayPaymentService>(); cuqmbr.TravelGuide.Infrastructure.Services.LiqPayPaymentService>()
.AddScoped<
EmailSenderService,
MailKitEmailSenderService>();
return services; return services;
} }

View File

@ -1,35 +1,31 @@
{ {
"Application": { "Logging": {
"Logging": { "Type": "SimpleConsole",
"Type": "SimpleConsole", "LogLevel": "Information",
"LogLevel": "Information", "TimestampFormat": "yyyy-MM-ddTHH:mm:ss.fffK",
"TimestampFormat": "yyyy-MM-ddTHH:mm:ss.fffK", "UseUtcTimestamp": true
"UseUtcTimestamp": true },
}, "Localization": {
"Datastore": { "DefaultCultureName": "en-US",
"Type": "postgresql", "CacheDuration": "00:30:00"
"ConnectionString": "Host=127.0.0.1:5432;Database=travel_guide;Username=postgres;Password=0000;Include Error Detail=true" },
}, "JsonWebToken": {
"Localization": { "Issuer": "https://api.travel-guide.cuqmbr.xyz",
"DefaultCultureName": "en-US", "Audience": "https://travel-guide.cuqmbr.xyz",
"CacheDuration": "00:30:00" "IssuerSigningKey": "a2c98dec80787a4e85ffb5bcbc24f7e4cc014d8a4fe43e9520480a50759164bc",
}, "AccessTokenValidity": "24:00:00",
"JsonWebToken": { "RefreshTokenValidity": "72:00:00"
"Issuer": "https://api.travel-guide.cuqmbr.xyz", },
"Audience": "https://travel-guide.cuqmbr.xyz", "Datastore": {
"IssuerSigningKey": "a2c98dec80787a4e85ffb5bcbc24f7e4cc014d8a4fe43e9520480a50759164bc", "Type": "postgresql",
"AccessTokenValidity": "24:00:00", "ConnectionString": "Host=127.0.0.1:5432;Database=travel_guide;Username=postgres;Password=0000;Include Error Detail=true"
"RefreshTokenValidity": "72:00:00" },
}, "PaymentProcessing": {
"Infrastructure": { "CallbackAddressBase": "https://api.travel-guide.cuqmbr.xyz",
"PaymentProcessing": { "ResultAddressBase": "https://travel-guide.cuqmbr.xyz",
"CallbackAddressBase": "https://api.travel-guide.cuqmbr.xyz", "LiqPay": {
"ResultAddressBase": "https://travel-guide.cuqmbr.xyz", "PublicKey": "sandbox_xxxxxxxxxxxx",
"LiqPay": { "PrivateKey": "sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
"PublicKey": "sandbox_xxxxxxxxxxxx",
"PrivateKey": "sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
} }
} }
} }

View File

@ -1,35 +1,31 @@
{ {
"Application": { "Logging": {
"Logging": { "Type": "SimpleConsole",
"Type": "SimpleConsole", "LogLevel": "Information",
"LogLevel": "Information", "TimestampFormat": "yyyy-MM-ddTHH:mm:ss.fffK",
"TimestampFormat": "yyyy-MM-ddTHH:mm:ss.fffK", "UseUtcTimestamp": true
"UseUtcTimestamp": true },
}, "Localization": {
"Datastore": { "DefaultCultureName": "en-US",
"Type": "postgresql", "CacheDuration": "00:30:00"
"ConnectionString": "Host=127.0.0.1:5432;Database=travel_guide;Username=postgres;Password=0000;Include Error Detail=true" },
}, "JsonWebToken": {
"Localization": { "Issuer": "https://api.travel-guide.cuqmbr.xyz",
"DefaultCultureName": "en-US", "Audience": "https://travel-guide.cuqmbr.xyz",
"CacheDuration": "00:30:00" "IssuerSigningKey": "a2c98dec80787a4e85ffb5bcbc24f7e4cc014d8a4fe43e9520480a50759164bc",
}, "AccessTokenValidity": "24:00:00",
"JsonWebToken": { "RefreshTokenValidity": "72:00:00"
"Issuer": "https://api.travel-guide.cuqmbr.xyz", },
"Audience": "https://travel-guide.cuqmbr.xyz", "Datastore": {
"IssuerSigningKey": "a2c98dec80787a4e85ffb5bcbc24f7e4cc014d8a4fe43e9520480a50759164bc", "Type": "postgresql",
"AccessTokenValidity": "24:00:00", "ConnectionString": "Host=127.0.0.1:5432;Database=travel_guide;Username=postgres;Password=0000;Include Error Detail=true"
"RefreshTokenValidity": "72:00:00" },
}, "PaymentProcessing": {
"Infrastructure": { "CallbackAddressBase": "https://api.travel-guide.cuqmbr.xyz",
"PaymentProcessing": { "ResultAddressBase": "https://travel-guide.cuqmbr.xyz",
"CallbackAddressBase": "https://api.travel-guide.cuqmbr.xyz", "LiqPay": {
"ResultAddressBase": "https://travel-guide.cuqmbr.xyz", "PublicKey": "sandbox_xxxxxxxxxxxx",
"LiqPay": { "PrivateKey": "sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
"PublicKey": "sandbox_xxxxxxxxxxxx",
"PrivateKey": "sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
} }
} }
} }

View File

@ -2,9 +2,9 @@ namespace cuqmbr.TravelGuide.Infrastructure;
public sealed class ConfigurationOptions public sealed class ConfigurationOptions
{ {
public static string SectionName { get; } = "Application:Infrastructure"; public static string SectionName { get; } = "";
public PaymentProcessingConfigurationOptions PaymentProcessing { get; set; } public PaymentProcessingConfigurationOptions PaymentProcessing { get; set; } = new();
} }
public sealed class PaymentProcessingConfigurationOptions public sealed class PaymentProcessingConfigurationOptions
@ -13,7 +13,7 @@ public sealed class PaymentProcessingConfigurationOptions
public string ResultAddressBase { get; set; } public string ResultAddressBase { get; set; }
public LiqPayConfigurationOptions LiqPay { get; set; } public LiqPayConfigurationOptions LiqPay { get; set; } = new();
} }
public sealed class LiqPayConfigurationOptions public sealed class LiqPayConfigurationOptions

View File

@ -2,7 +2,7 @@ namespace cuqmbr.TravelGuide.Persistence;
public sealed class ConfigurationOptions public sealed class ConfigurationOptions
{ {
public static string SectionName { get; } = "Application:Datastore"; public static string SectionName { get; } = "Datastore";
public string Type { get; set; } = "inmemory"; public string Type { get; set; } = "inmemory";