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 System.Reflection;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -10,6 +11,12 @@ using Server.DB;
|
||||||
using Server.Services;
|
using Server.Services;
|
||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder();
|
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.Services.AddLogging();
|
||||||
builder.Logging.AddFile("Logs/Server-{Date}.log", LogLevel.Trace);
|
builder.Logging.AddFile("Logs/Server-{Date}.log", LogLevel.Trace);
|
||||||
builder.Logging.AddFile("Logs/Server-{Date}.json.log", LogLevel.Trace, isJson: true);
|
builder.Logging.AddFile("Logs/Server-{Date}.json.log", LogLevel.Trace, isJson: true);
|
||||||
|
|
|
@ -69,8 +69,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="settings.json">
|
<Content Include="settings.Development.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Add table
Reference in a new issue