AddEnvironmentVariables fix

master
Tudor Stanciu 2021-11-14 11:40:19 +02:00
parent 958a8499f8
commit 3757a25ed1
1 changed files with 6 additions and 1 deletions

View File

@ -27,6 +27,7 @@ namespace IdentityServer.Api
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
var connectionString = configuration.GetConnectionString("DatabaseConnection");
@ -42,14 +43,18 @@ namespace IdentityServer.Api
var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs" };
Serilog.Debugging.SelfLog.Enable(msg => Console.WriteLine(msg));
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(loggingLevelSwitch)
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions)
.CreateLogger();
Serilog.Debugging.SelfLog.Enable(msg => Console.WriteLine(msg));
try
{
var urls = configuration.GetValue<string>("urls");