2026-06-14 18:30:15 +01:00
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
|
|
|
|
namespace Yavsc.Server.Helpers;
|
|
|
|
|
|
|
|
|
|
public static class ConfigHelpers
|
|
|
|
|
{
|
2026-06-14 23:04:24 +01:00
|
|
|
public static IConfigurationBuilder AddConfiguration(this WebApplicationBuilder builder, string appName )
|
2026-06-14 18:30:15 +01:00
|
|
|
{
|
|
|
|
|
var rootConfig = builder.Configuration
|
2026-06-15 00:11:48 +01:00
|
|
|
.AddJsonFile($"appsettings-{appName}.json", optional: false, reloadOnChange: false);
|
2026-06-14 18:30:15 +01:00
|
|
|
|
2026-06-15 00:11:48 +01:00
|
|
|
rootConfig.AddJsonFile($"appsettings-{appName}.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
|
|
|
|
|
2026-06-14 23:04:24 +01:00
|
|
|
return rootConfig.AddEnvironmentVariables();
|
2026-06-14 18:30:15 +01:00
|
|
|
}
|
|
|
|
|
}
|