config: a little dynamic config based on environmnet
All checks were successful
Test if Server can be built / build-server (push) Successful in 23s
All checks were successful
Test if Server can be built / build-server (push) Successful in 23s
This commit is contained in:
parent
f802dcf2a3
commit
d44d072823
3 changed files with 9 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -69,8 +69,8 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="settings.json">
|
||||
<Content Include="settings.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue