1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01: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

@ -86,7 +86,7 @@ build_script:
$env:ASPNETCORE_ENVIRONMENT = "Production" $env:ASPNETCORE_ENVIRONMENT = "Production"
cd .\src\Api cd .\src\Api
dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com --format Indented ` dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com --format Indented `
.\bin\Debug\netcoreapp2.1\Api.dll public .\bin\Debug\netcoreapp2.2\Api.dll public
cd ..\.. cd ..\..
$env:ASPNETCORE_ENVIRONMENT = "" $env:ASPNETCORE_ENVIRONMENT = ""
$env:swaggerGen = "" $env:swaggerGen = ""

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio Version 16
VisualStudioVersion = 15.0.27130.2003 VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}"
EndProject EndProject
@ -47,7 +47,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Test", "test\Core.Test
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventsProcessor", "src\EventsProcessor\EventsProcessor.csproj", "{79BB453F-D0D8-4DDF-9809-A405C56692BD}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventsProcessor", "src\EventsProcessor\EventsProcessor.csproj", "{79BB453F-D0D8-4DDF-9809-A405C56692BD}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migrator", "util\Migrator\Migrator.csproj", "{54DED792-A022-417E-9804-21FCC9C7C610}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrator", "util\Migrator\Migrator.csproj", "{54DED792-A022-417E-9804-21FCC9C7C610}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.31.0</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Admin</RootNamespace> <RootNamespace>Bit.Admin</RootNamespace>
<UserSecretsId>bitwarden-Admin</UserSecretsId> <UserSecretsId>bitwarden-Admin</UserSecretsId>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -13,17 +14,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.9" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
</ItemGroup>
<ItemGroup>
<Content Update="Views\Shared\_BillingInformation.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Views\Tools\CreateUpdateTransaction.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

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" LABEL com.bitwarden.product="bitwarden"

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore; using Bit.Core.Utilities;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Serilog.Events;
namespace Bit.Admin namespace Bit.Admin
{ {
@ -10,6 +12,8 @@ namespace Bit.Admin
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e => e.Level >= LogEventLevel.Error))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -5,13 +5,10 @@ using Bit.Core.Identity;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog.Events;
using Stripe; using Stripe;
namespace Bit.Admin namespace Bit.Admin
@ -98,10 +95,9 @@ namespace Bit.Admin
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings, GlobalSettings globalSettings)
ILoggerFactory loggerFactory)
{ {
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error); app.UseSerilog(env, appLifetime, globalSettings);
if(globalSettings.SelfHosted) if(globalSettings.SelfHosted)
{ {

View File

@ -2,10 +2,11 @@
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Api</RootNamespace> <RootNamespace>Bit.Api</RootNamespace>
<UserSecretsId>bitwarden-Api</UserSecretsId> <UserSecretsId>bitwarden-Api</UserSecretsId>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
@ -22,7 +23,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
</ItemGroup> </ItemGroup>

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" LABEL com.bitwarden.product="bitwarden"

View File

@ -1,5 +1,9 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
using Microsoft.IdentityModel.Tokens;
using AspNetCoreRateLimit;
namespace Bit.Api namespace Bit.Api
{ {
@ -10,6 +14,29 @@ namespace Bit.Api
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
e.Exception.Message == "Bad security stamp."))
{
return false;
}
if(e.Level == LogEventLevel.Information && context.Contains(typeof(IpRateLimitMiddleware).FullName))
{
return true;
}
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
}))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -3,13 +3,11 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using Bit.Api.Utilities; using Bit.Api.Utilities;
using Bit.Core; using Bit.Core;
using Bit.Core.Identity; using Bit.Core.Identity;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using AspNetCoreRateLimit; using AspNetCoreRateLimit;
using Serilog.Events;
using Stripe; using Stripe;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using IdentityModel; using IdentityModel;
@ -140,32 +138,10 @@ namespace Bit.Api
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings) GlobalSettings globalSettings)
{ {
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => app.UseSerilog(env, appLifetime, globalSettings);
{
var context = e.Properties["SourceContext"].ToString();
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
e.Exception.Message == "Bad security stamp."))
{
return false;
}
if(e.Level == LogEventLevel.Information && context.Contains(typeof(IpRateLimitMiddleware).FullName))
{
return true;
}
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
});
// Default Middleware // Default Middleware
app.UseDefaultMiddleware(env); app.UseDefaultMiddleware(env);

View File

@ -2,10 +2,13 @@
<configuration> <configuration>
<system.webServer> <system.webServer>
<handlers> <handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers> </handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00"> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00" hostingModel="InProcess">
<environmentVariables /> <environmentVariables>
<environmentVariable name="COMPLUS_ForceENC" value="1" />
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore> </aspNetCore>
<security> <security>
<requestFiltering> <requestFiltering>

View File

@ -2,10 +2,11 @@
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Billing</RootNamespace> <RootNamespace>Bit.Billing</RootNamespace>
<UserSecretsId>bitwarden-Billing</UserSecretsId> <UserSecretsId>bitwarden-Billing</UserSecretsId>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -13,8 +14,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.9" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Billing namespace Bit.Billing
{ {
@ -10,6 +12,18 @@ namespace Bit.Billing
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(e.Level == LogEventLevel.Information &&
(context.StartsWith("\"Bit.Billing.Jobs") || context.StartsWith("\"Bit.Core.Jobs")))
{
return true;
}
return e.Level >= LogEventLevel.Warning;
}))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -3,11 +3,9 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Bit.Core; using Bit.Core;
using Stripe; using Stripe;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Serilog.Events;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
@ -75,20 +73,9 @@ namespace Bit.Billing
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings, GlobalSettings globalSettings)
ILoggerFactory loggerFactory)
{ {
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => app.UseSerilog(env, appLifetime, globalSettings);
{
var context = e.Properties["SourceContext"].ToString();
if(e.Level == LogEventLevel.Information &&
(context.StartsWith("\"Bit.Billing.Jobs") || context.StartsWith("\"Bit.Core.Jobs")))
{
return true;
}
return e.Level >= LogEventLevel.Warning;
});
if(env.IsDevelopment()) if(env.IsDevelopment())
{ {

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Core</RootNamespace> <RootNamespace>Bit.Core</RootNamespace>
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute> <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
@ -26,20 +26,21 @@
<PackageReference Include="Handlebars.Net" Version="1.10.1" /> <PackageReference Include="Handlebars.Net" Version="1.10.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" /> <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
<PackageReference Include="MailKit" Version="2.1.4" /> <PackageReference Include="MailKit" Version="2.1.4" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureStorage" Version="2.1.1" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureStorage" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="2.1.1" /> <PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.1.6" /> <PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.1.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.NotificationHubs" Version="3.1.0" /> <PackageReference Include="Microsoft.Azure.NotificationHubs" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.4.0" /> <PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.4.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.1.1" /> <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.6" /> <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.2.0" />
<PackageReference Include="NBitpayClient" Version="1.0.0.34" /> <PackageReference Include="NBitpayClient" Version="1.0.0.34" />
<PackageReference Include="Npgsql" Version="4.0.6" /> <PackageReference Include="Npgsql" Version="4.0.6" />
<PackageReference Include="Quartz" Version="3.0.7" /> <PackageReference Include="Quartz" Version="3.0.7" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.4" /> <PackageReference Include="Serilog.Extensions.Logging" Version="2.0.4" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" /> <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" /> <PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" />
@ -55,7 +56,7 @@
<PackageReference Include="U2F.Core" Version="1.0.4" /> <PackageReference Include="U2F.Core" Version="1.0.4" />
<PackageReference Include="Otp.NET" Version="1.2.1" /> <PackageReference Include="Otp.NET" Version="1.2.1" />
<PackageReference Include="YubicoDotNetClient" Version="1.2.0" /> <PackageReference Include="YubicoDotNetClient" Version="1.2.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" /> <PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
@ -9,17 +10,32 @@ namespace Bit.Core.Utilities
{ {
public static class LoggerFactoryExtensions public static class LoggerFactoryExtensions
{ {
public static ILoggerFactory AddSerilog( public static void UseSerilog(
this ILoggerFactory factory, this IApplicationBuilder appBuilder,
IApplicationBuilder appBuilder,
IHostingEnvironment env, IHostingEnvironment env,
IApplicationLifetime appLifetime, IApplicationLifetime applicationLifetime,
GlobalSettings globalSettings, GlobalSettings globalSettings)
Func<LogEvent, bool> filter = null)
{ {
if(env.IsDevelopment()) if(env.IsDevelopment())
{ {
return factory; return;
}
if(CoreHelpers.SettingHasValue(globalSettings?.Sentry.Dsn))
{
appBuilder.AddSentryContext();
}
applicationLifetime.ApplicationStopped.Register(Log.CloseAndFlush);
}
public static ILoggingBuilder AddSerilog(
this ILoggingBuilder builder,
WebHostBuilderContext context,
Func<LogEvent, bool> filter = null)
{
if(context.HostingEnvironment.IsDevelopment())
{
return builder;
} }
bool inclusionPredicate(LogEvent e) bool inclusionPredicate(LogEvent e)
@ -36,6 +52,9 @@ namespace Bit.Core.Utilities
return filter(e); return filter(e);
} }
var globalSettings = new GlobalSettings();
ConfigurationBinder.Bind(context.Configuration.GetSection("GlobalSettings"), globalSettings);
var config = new LoggerConfiguration() var config = new LoggerConfiguration()
.Enrich.FromLogContext() .Enrich.FromLogContext()
.Filter.ByIncludingOnly(inclusionPredicate); .Filter.ByIncludingOnly(inclusionPredicate);
@ -55,8 +74,6 @@ namespace Bit.Core.Utilities
.Enrich.WithProperty("Project", globalSettings.ProjectName) .Enrich.WithProperty("Project", globalSettings.ProjectName)
.Destructure.With<HttpContextDestructingPolicy>() .Destructure.With<HttpContextDestructingPolicy>()
.Filter.ByExcluding(e => e.Exception?.CheckIfCaptured() == true); .Filter.ByExcluding(e => e.Exception?.CheckIfCaptured() == true);
appBuilder.AddSentryContext();
} }
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory)) else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
{ {
@ -66,10 +83,9 @@ namespace Bit.Core.Utilities
} }
var serilog = config.CreateLogger(); var serilog = config.CreateLogger();
factory.AddSerilog(serilog); builder.AddSerilog(serilog);
appLifetime.ApplicationStopped.Register(Log.CloseAndFlush);
return factory; return builder;
} }
} }
} }

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" LABEL com.bitwarden.product="bitwarden"

View File

@ -2,14 +2,15 @@
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Events</RootNamespace> <RootNamespace>Bit.Events</RootNamespace>
<UserSecretsId>bitwarden-Events</UserSecretsId> <UserSecretsId>bitwarden-Events</UserSecretsId>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Events namespace Bit.Events
{ {
@ -10,6 +12,18 @@ namespace Bit.Events
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .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;
}
return e.Level >= LogEventLevel.Error;
}))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -7,8 +7,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog.Events;
namespace Bit.Events namespace Bit.Events
{ {
@ -82,21 +80,10 @@ namespace Bit.Events
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings) GlobalSettings globalSettings)
{ {
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => app.UseSerilog(env, appLifetime, globalSettings);
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
});
if(env.IsDevelopment()) if(env.IsDevelopment())
{ {

View File

@ -2,13 +2,14 @@
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.EventsProcessor</RootNamespace> <RootNamespace>Bit.EventsProcessor</RootNamespace>
<UserSecretsId>bitwarden-EventsProcessor</UserSecretsId> <UserSecretsId>bitwarden-EventsProcessor</UserSecretsId>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.EventsProcessor namespace Bit.EventsProcessor
{ {
@ -10,6 +12,8 @@ namespace Bit.EventsProcessor
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e => e.Level >= LogEventLevel.Warning))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -5,9 +5,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging; using Microsoft.IdentityModel.Logging;
using Serilog.Events;
namespace Bit.EventsProcessor namespace Bit.EventsProcessor
{ {
@ -29,7 +27,7 @@ namespace Bit.EventsProcessor
services.AddOptions(); services.AddOptions();
// Settings // Settings
var globalSettings = services.AddGlobalSettingsServices(Configuration); services.AddGlobalSettingsServices(Configuration);
// Hosted Services // Hosted Services
services.AddHostedService<AzureQueueHostedService>(); services.AddHostedService<AzureQueueHostedService>();
@ -38,12 +36,11 @@ namespace Bit.EventsProcessor
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings) GlobalSettings globalSettings)
{ {
IdentityModelEventSource.ShowPII = true; IdentityModelEventSource.ShowPII = true;
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Warning); app.UseSerilog(env, appLifetime, globalSettings);
} }
} }
} }

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" LABEL com.bitwarden.product="bitwarden"

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Icons</RootNamespace> <RootNamespace>Bit.Icons</RootNamespace>
<UserSecretsId>bitwarden-Icons</UserSecretsId> <UserSecretsId>bitwarden-Icons</UserSecretsId>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
@ -10,7 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AngleSharp" Version="0.12.0" /> <PackageReference Include="AngleSharp" Version="0.12.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,7 @@
using System; using Microsoft.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Icons namespace Bit.Icons
{ {
@ -11,6 +12,8 @@ namespace Bit.Icons
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e => e.Level >= LogEventLevel.Error))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -8,9 +8,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
using Serilog.Events;
namespace Bit.Icons namespace Bit.Icons
{ {
@ -52,11 +50,10 @@ namespace Bit.Icons
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings) GlobalSettings globalSettings)
{ {
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error); app.UseSerilog(env, appLifetime, globalSettings);
if(env.IsDevelopment()) if(env.IsDevelopment())
{ {

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" LABEL com.bitwarden.product="bitwarden"

View File

@ -2,10 +2,11 @@
<PropertyGroup> <PropertyGroup>
<Version>1.30.4</Version> <Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Identity</RootNamespace> <RootNamespace>Bit.Identity</RootNamespace>
<UserSecretsId>bitwarden-Identity</UserSecretsId> <UserSecretsId>bitwarden-Identity</UserSecretsId>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -13,7 +14,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,8 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
using AspNetCoreRateLimit;
namespace Bit.Identity namespace Bit.Identity
{ {
@ -10,6 +13,23 @@ namespace Bit.Identity
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{
return true;
}
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
}))
.Build() .Build()
.Run(); .Run();
} }

View File

@ -2,11 +2,9 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Bit.Core; using Bit.Core;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Serilog.Events;
using AspNetCoreRateLimit; using AspNetCoreRateLimit;
using System.Globalization; using System.Globalization;
@ -76,26 +74,10 @@ namespace Bit.Identity
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings) GlobalSettings globalSettings)
{ {
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => app.UseSerilog(env, appLifetime, globalSettings);
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{
return true;
}
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
});
// Default Middleware // Default Middleware
app.UseDefaultMiddleware(env); app.UseDefaultMiddleware(env);

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" LABEL com.bitwarden.product="bitwarden"

View File

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

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Notifications namespace Bit.Notifications
{ {
@ -10,6 +12,28 @@ namespace Bit.Notifications
WebHost WebHost
.CreateDefaultBuilder(args) .CreateDefaultBuilder(args)
.UseStartup<Startup>() .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() .Build()
.Run(); .Run();
} }

View File

@ -8,9 +8,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging; using Microsoft.IdentityModel.Logging;
using Serilog.Events;
namespace Bit.Notifications namespace Bit.Notifications
{ {
@ -84,32 +82,11 @@ namespace Bit.Notifications
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
IHostingEnvironment env, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime, IApplicationLifetime appLifetime,
GlobalSettings globalSettings) GlobalSettings globalSettings)
{ {
IdentityModelEventSource.ShowPII = true; IdentityModelEventSource.ShowPII = true;
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => app.UseSerilog(env, appLifetime, globalSettings);
{
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;
});
if(env.IsDevelopment()) if(env.IsDevelopment())
{ {

View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<RootNamespace>Bit.Core.Test</RootNamespace> <RootNamespace>Bit.Core.Test</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="NSubstitute" Version="4.1.0" /> <PackageReference Include="NSubstitute" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Migrator</RootNamespace> <RootNamespace>Bit.Migrator</RootNamespace>
</PropertyGroup> </PropertyGroup>
@ -11,7 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="dbup-sqlserver" Version="4.2.0" /> <PackageReference Include="dbup-sqlserver" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

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" LABEL com.bitwarden.product="bitwarden"

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Bit.Server namespace Bit.Server
{ {
@ -14,7 +15,12 @@ namespace Bit.Server
var builder = new WebHostBuilder() var builder = new WebHostBuilder()
.UseConfiguration(config) .UseConfiguration(config)
.UseKestrel() .UseKestrel()
.UseStartup<Startup>(); .UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole().AddDebug();
})
.ConfigureKestrel((context, options) => { });
var contentRoot = config.GetValue<string>("contentRoot"); var contentRoot = config.GetValue<string>("contentRoot");
if(string.IsNullOrWhiteSpace(contentRoot)) if(string.IsNullOrWhiteSpace(contentRoot))

View File

@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<RootNamespace>Bit.Server</RootNamespace> <RootNamespace>Bit.Server</RootNamespace>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" /> <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Bit.Server namespace Bit.Server
{ {
@ -30,13 +29,8 @@ namespace Bit.Server
public void Configure( public void Configure(
IApplicationBuilder app, IApplicationBuilder app,
ILoggerFactory loggerFactory,
IConfiguration configuration) IConfiguration configuration)
{ {
loggerFactory
.AddConsole()
.AddDebug();
if(configuration.GetValue<bool?>("serveUnknown") ?? false) if(configuration.GetValue<bool?>("serveUnknown") ?? false)
{ {
app.UseStaticFiles(new StaticFileOptions app.UseStaticFiles(new StaticFileOptions

View File

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

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<NoWarn>1701;1702;1705;NU1701</NoWarn> <NoWarn>1701;1702;1705;NU1701</NoWarn>
<RootNamespace>Bit.Setup</RootNamespace> <RootNamespace>Bit.Setup</RootNamespace>
</PropertyGroup> </PropertyGroup>
@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Handlebars.Net" Version="1.10.1" /> <PackageReference Include="Handlebars.Net" Version="1.10.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="YamlDotNet" Version="6.0.0" /> <PackageReference Include="YamlDotNet" Version="6.0.0" />
</ItemGroup> </ItemGroup>