mirror of
https://github.com/bitwarden/server.git
synced 2025-05-18 18:15:37 -05:00
58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using System;
|
|
using Bit.Icons.Services;
|
|
using Microsoft.ApplicationInsights.Extensibility;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Bit.Icons
|
|
{
|
|
public class Startup
|
|
{
|
|
public Startup(IConfiguration configuration)
|
|
{
|
|
Configuration = configuration;
|
|
}
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
// Options
|
|
services.AddOptions();
|
|
|
|
// Settings
|
|
var iconsSettings = new IconsSettings();
|
|
ConfigurationBinder.Bind(Configuration.GetSection("IconsSettings"), iconsSettings);
|
|
services.AddSingleton(s => iconsSettings);
|
|
|
|
// Cache
|
|
services.AddMemoryCache(options =>
|
|
{
|
|
options.SizeLimit = iconsSettings.CacheSizeLimit;
|
|
});
|
|
services.AddResponseCaching();
|
|
|
|
// Services
|
|
services.AddSingleton<IDomainMappingService, DomainMappingService>();
|
|
|
|
// Mvc
|
|
services.AddMvc();
|
|
}
|
|
|
|
public void Configure(
|
|
IApplicationBuilder app,
|
|
IHostingEnvironment env)
|
|
{
|
|
if(env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
app.UseResponseCaching();
|
|
app.UseMvc();
|
|
}
|
|
}
|
|
}
|