mirror of
https://github.com/bitwarden/server
synced 2025-12-15 07:43:54 +00:00
command config for server, serve unknown files
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
@@ -8,9 +10,28 @@ namespace Server
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{ }
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
public void Configure(
|
||||
IApplicationBuilder app,
|
||||
ILoggerFactory loggerFactory,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
app.UseFileServer();
|
||||
loggerFactory
|
||||
.AddConsole()
|
||||
.AddDebug();
|
||||
|
||||
var serveUnknown = configuration.GetValue<bool?>("serveUnknown") ?? false;
|
||||
if(serveUnknown)
|
||||
{
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
ServeUnknownFileTypes = true,
|
||||
DefaultContentType = "application/octet-stream"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseFileServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user