You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
|
|
using Furion;
|
|
using Microsoft.AspNetCore.HttpOverrides;
|
|
using NapCatRobotClient.Core.Helper;
|
|
using System.Net;
|
|
|
|
namespace NapCatRobotClient.API
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args).Inject();
|
|
builder.WebHost.UseUrls(App.Configuration["AppSettings:Urls"]);
|
|
|
|
builder.Services.AddRedis(App.Configuration["ConnectionStrings:Redis"]);
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
|
|
app.UseInject(string.Empty);
|
|
|
|
app.EnableBuffering();
|
|
|
|
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
|
{
|
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
|
|
KnownProxies = { IPAddress.Parse("127.0.0.1") }
|
|
});
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
}
|