1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

upgrade to aspnet core 3.1

This commit is contained in:
Kyle Spearrin
2020-01-10 08:33:13 -05:00
parent 8026912eeb
commit 29580684a3
60 changed files with 429 additions and 420 deletions

View File

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

View File

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

View File

@ -33,12 +33,17 @@ namespace Bit.Server
{
if(configuration.GetValue<bool?>("serveUnknown") ?? false)
{
app.Map("/alive", HandleMapAlive);
app.UseStaticFiles(new StaticFileOptions
{
ServeUnknownFileTypes = true,
DefaultContentType = "application/octet-stream"
});
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/alive",
async context => await context.Response.WriteAsync(System.DateTime.UtcNow.ToString()));
});
}
else if(configuration.GetValue<bool?>("webVault") ?? false)
{
@ -71,14 +76,14 @@ namespace Bit.Server
}
else
{
app.Map("/alive", HandleMapAlive);
app.UseFileServer();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/alive",
async context => await context.Response.WriteAsync(System.DateTime.UtcNow.ToString()));
});
}
}
private static void HandleMapAlive(IApplicationBuilder app)
{
app.Run(async context => await context.Response.WriteAsync(System.DateTime.UtcNow.ToString()));
}
}
}