1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 16:42:50 -05:00

update to net core 2.2

This commit is contained in:
Kyle Spearrin
2019-07-23 16:38:49 -04:00
parent 3422df325b
commit 94188fa0b5
43 changed files with 227 additions and 199 deletions

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.10
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
LABEL com.bitwarden.product="bitwarden"

View File

@ -2,15 +2,16 @@
<PropertyGroup>
<Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Notifications</RootNamespace>
<UserSecretsId>bitwarden-Notifications</UserSecretsId>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="1.0.4" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.9" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="1.1.5" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.11" />
</ItemGroup>
<ItemGroup>

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Notifications
{
@ -10,6 +12,28 @@ namespace Bit.Notifications
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
if(e.Level == LogEventLevel.Error && e.MessageTemplate.Text == "Failed connection handshake.")
{
return false;
}
if(e.Level == LogEventLevel.Warning && e.MessageTemplate.Text.StartsWith("Heartbeat took longer"))
{
return false;
}
return e.Level >= LogEventLevel.Warning;
}))
.Build()
.Run();
}

View File

@ -8,9 +8,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging;
using Serilog.Events;
namespace Bit.Notifications
{
@ -84,32 +82,11 @@ namespace Bit.Notifications
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime,
GlobalSettings globalSettings)
{
IdentityModelEventSource.ShowPII = true;
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) =>
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
if(e.Level == LogEventLevel.Error && e.MessageTemplate.Text == "Failed connection handshake.")
{
return false;
}
if(e.Level == LogEventLevel.Warning && e.MessageTemplate.Text.StartsWith("Heartbeat took longer"))
{
return false;
}
return e.Level >= LogEventLevel.Warning;
});
app.UseSerilog(env, appLifetime, globalSettings);
if(env.IsDevelopment())
{