mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 18:51:18 +01:00
71 lines
1.8 KiB
C#
71 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Hosting;
|
|
using System.Linq;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NBitpayClient;
|
|
using BTCPayServer.Authentication;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using BTCPayServer.Filters;
|
|
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
|
using BTCPayServer.Services;
|
|
using BTCPayServer.Models;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using BTCPayServer.Data;
|
|
using Microsoft.Extensions.Logging;
|
|
using BTCPayServer.Logging;
|
|
|
|
namespace BTCPayServer.Hosting
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
|
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
|
.AddEntityFrameworkStores<ApplicationDbContext>()
|
|
.AddDefaultTokenProviders();
|
|
|
|
// Add application services.
|
|
services.AddTransient<IEmailSender, EmailSender>();
|
|
|
|
//services.AddSingleton<IObjectModelValidator, NoObjectModelValidator>();
|
|
services.AddMvcCore(o =>
|
|
{
|
|
//o.Filters.Add(new NBXplorerExceptionFilter());
|
|
o.OutputFormatters.Clear();
|
|
o.InputFormatters.Clear();
|
|
})
|
|
.AddJsonFormatters()
|
|
.AddFormatterMappings();
|
|
services.AddMvc();
|
|
}
|
|
public void Configure(
|
|
IApplicationBuilder app,
|
|
IHostingEnvironment env,
|
|
ILoggerFactory loggerFactory)
|
|
{
|
|
if(env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
app.UseBrowserLink();
|
|
}
|
|
Logs.Configure(loggerFactory);
|
|
app.UsePayServer();
|
|
app.UseStaticFiles();
|
|
app.UseAuthentication();
|
|
|
|
app.UseMvc(routes =>
|
|
{
|
|
routes.MapRoute(
|
|
name: "default",
|
|
template: "{controller=Home}/{action=Index}/{id?}");
|
|
});
|
|
}
|
|
}
|
|
}
|