2019-07-23 22:38:49 +02:00
|
|
|
|
using Bit.Core.Utilities;
|
2018-03-21 17:57:43 +01:00
|
|
|
|
|
|
|
|
|
namespace Bit.Admin;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-03-21 17:57:43 +01:00
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
2020-01-10 14:33:13 +01:00
|
|
|
|
Host
|
2018-03-21 17:57:43 +01:00
|
|
|
|
.CreateDefaultBuilder(args)
|
2021-04-09 15:48:43 +02:00
|
|
|
|
.ConfigureCustomAppConfiguration(args)
|
2020-01-10 14:33:13 +01:00
|
|
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
2022-08-29 22:06:55 +02:00
|
|
|
|
{
|
2019-09-04 18:54:19 +02:00
|
|
|
|
webBuilder.ConfigureKestrel(o =>
|
2022-08-29 20:53:16 +02:00
|
|
|
|
{
|
2019-09-04 18:54:19 +02:00
|
|
|
|
o.Limits.MaxRequestLineSize = 20_000;
|
2022-08-29 21:53:48 +02:00
|
|
|
|
});
|
2019-09-04 18:54:19 +02:00
|
|
|
|
webBuilder.UseStartup<Startup>();
|
|
|
|
|
webBuilder.ConfigureLogging((hostingContext, logging) =>
|
2022-09-26 21:22:02 +02:00
|
|
|
|
logging.AddSerilog(hostingContext, (e, globalSettings) =>
|
2022-08-29 22:06:55 +02:00
|
|
|
|
{
|
2019-09-04 18:54:19 +02:00
|
|
|
|
var context = e.Properties["SourceContext"].ToString();
|
2020-03-27 19:36:37 +01:00
|
|
|
|
if (e.Properties.ContainsKey("RequestPath") &&
|
2019-09-04 18:54:19 +02:00
|
|
|
|
!string.IsNullOrWhiteSpace(e.Properties["RequestPath"]?.ToString()) &&
|
|
|
|
|
(context.Contains(".Server.Kestrel") || context.Contains(".Core.IISHttpServer")))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-09-26 21:22:02 +02:00
|
|
|
|
return e.Level >= globalSettings.MinLogLevel.AdminSettings.Default;
|
2020-01-10 14:33:13 +01:00
|
|
|
|
}));
|
|
|
|
|
})
|
2018-03-21 17:57:43 +01:00
|
|
|
|
.Build()
|
|
|
|
|
.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|