diff --git a/Server/Program.cs b/Server/Program.cs index a8807c3..fe92ed4 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -3,6 +3,7 @@ using System.Net; using System.Reflection; using MassTransit; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -10,6 +11,12 @@ using Server.DB; using Server.Services; var builder = Host.CreateApplicationBuilder(); +#if DEBUG +builder.Environment.EnvironmentName = "Development"; +#endif +builder.Configuration.AddJsonFile("settings.json", true, true) + .AddJsonFile($"settings.{builder.Environment.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables().Build(); builder.Services.AddLogging(); builder.Logging.AddFile("Logs/Server-{Date}.log", LogLevel.Trace); builder.Logging.AddFile("Logs/Server-{Date}.json.log", LogLevel.Trace, isJson: true); diff --git a/Server/Server.csproj b/Server/Server.csproj index 01295aa..913a9f4 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -69,8 +69,8 @@ - + PreserveNewest - + diff --git a/Server/settings.json b/Server/settings.Development.json similarity index 100% rename from Server/settings.json rename to Server/settings.Development.json