-
Notifications
You must be signed in to change notification settings - Fork 7
/
Program.cs
48 lines (43 loc) · 1.74 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Dvelop.Remote;
using Dvelop.Sdk.Logging.OtelJsonConsole.Extension;
using Dvelop.Selfhosted.HostApplication.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
namespace Dvelop.Selfhosted.HostApplication
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost().Run();
}
public static IHost BuildWebHost()
{
var hostBuilder = Host.CreateDefaultBuilder().ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureAppConfiguration((context, configBuilder) =>
{
configBuilder.AddJsonFile("appsettings.json", true, true);
configBuilder.AddJsonFile("appsettings.custom.json", true, true);
configBuilder.AddEnvironmentVariables();
})
.ConfigureLogging(loggingBuilder =>
{
loggingBuilder.ClearProviders();
loggingBuilder.AddSimpleConsole(options=>
{
options.SingleLine = true;
options.ColorBehavior = LoggerColorBehavior.Disabled;
});
// loggingBuilder.AddOtelJsonConsole();
})
.UseStartup<Startup>();
}).UseServiceProviderFactory(new EnvironmentAwareServiceProviderFactory(new SelfHostedServiceProviderFactory()));
var webHost = hostBuilder.Build();
return webHost;
}
}
}