Files
server/src/Identity/Program.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.6 KiB
C#
Raw Normal View History

2020-01-10 08:33:13 -05:00
using AspNetCoreRateLimit;
2019-07-23 16:38:49 -04:00
using Bit.Core.Utilities;
using Serilog.Events;
2017-05-05 16:05:34 -04:00
namespace Bit.Identity
2017-05-05 16:05:34 -04:00
{
public class Program
2017-05-05 16:05:34 -04:00
{
public static void Main(string[] args)
{
CreateHostBuilder(args)
.Build()
.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host
.CreateDefaultBuilder(args)
.ConfigureCustomAppConfiguration(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
2019-07-23 16:38:49 -04:00
{
var context = e.Properties["SourceContext"].ToString();
if (context.Contains(typeof(IpRateLimitMiddleware).FullName) &&
e.Level == LogEventLevel.Information)
{
return true;
}
2019-07-23 16:38:49 -04:00
if (context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
2019-07-23 16:38:49 -04:00
return e.Level >= LogEventLevel.Error;
}));
});
}
2017-05-05 16:05:34 -04:00
}
}