synchro with main
This commit is contained in:
parent
26d36dee71
commit
d0e594c359
3 changed files with 22 additions and 5 deletions
18
src/Yavsc.Server/Helpers/ConfigHelpers.cs
Normal file
18
src/Yavsc.Server/Helpers/ConfigHelpers.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Yavsc.Server.Helpers;
|
||||
|
||||
public static class ConfigHelpers
|
||||
{
|
||||
public static void AddConfiguration(this WebApplicationBuilder builder, string appName )
|
||||
{
|
||||
var rootConfig = builder.Configuration
|
||||
.AddJsonFile($"appsettings-{appName}.json", optional: false, reloadOnChange: false);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(builder.Environment.EnvironmentName))
|
||||
rootConfig.AddJsonFile($"appsettings-{appName}.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||
;
|
||||
rootConfig.AddEnvironmentVariables();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue