Refactor configuration setup and error handling
- Added custom configuration sources to the builder. - Removed Azure Key Vault integration for secret management.
This commit is contained in:
parent
ba01cfcaf7
commit
29e1f2fd62
@ -22,17 +22,7 @@ builder.AddCustomConfigurationSources();
|
||||
WebApplication? app = null;
|
||||
try
|
||||
{
|
||||
var keyVaultName = builder.Configuration["KeyVaultName"] ?? "";
|
||||
if (!string.IsNullOrEmpty(keyVaultName))
|
||||
{
|
||||
var keyVaultUri = $"https://{keyVaultName}.vault.azure.net/";
|
||||
builder.Configuration.AddAzureKeyVault(
|
||||
new Uri(keyVaultUri),
|
||||
new DefaultAzureCredential(),
|
||||
new SurgeKeyVaultSecretManager()
|
||||
);
|
||||
}
|
||||
builder.Services.AddSingleton<ILoggingService, LoggingService>();
|
||||
builder.AddCustomConfigurationSources();
|
||||
|
||||
var jwtKey = Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Secret"]!);
|
||||
builder.Services.AddAuthentication(options =>
|
||||
@ -57,7 +47,6 @@ try
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
|
||||
Factory.RegisterDefaultServices(builder.Services,
|
||||
adminContextProvider: provider =>
|
||||
{
|
||||
@ -138,8 +127,6 @@ try
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user