mirror of
https://git.recroomarchive.org/RecRoomArchive/RRAC.git
synced 2026-09-08 14:41:25 -07:00
59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using RecRoomArchive.Models.Common;
|
|
using RecRoomArchive.Services;
|
|
using Serilog;
|
|
|
|
namespace RecRoomArchive
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.WebHost.UseKestrel();
|
|
|
|
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
|
|
|
|
#region Services
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddOpenApi();
|
|
builder.Services.AddHttpContextAccessor();
|
|
builder.Services.AddSerilog();
|
|
|
|
builder.Services.AddScoped<AccountService>();
|
|
builder.Services.AddScoped<AppVersionService>();
|
|
builder.Services.AddScoped<AuthorizationService>();
|
|
builder.Services.AddScoped<ConfigService>();
|
|
builder.Services.AddScoped<FileService>();
|
|
builder.Services.AddScoped<ImageService>();
|
|
builder.Services.AddScoped<MessageOfTheDayService>();
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
#endregion
|
|
|
|
Console.Title = $"RRAC {Constants.Version}";
|
|
|
|
var app = builder.Build();
|
|
|
|
app.MapOpenApi();
|
|
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
|
|
app.UseSerilogRequestLogging();
|
|
|
|
app.UseAuthorization();
|
|
|
|
var webSocketOptions = new WebSocketOptions
|
|
{
|
|
KeepAliveInterval = TimeSpan.FromMinutes(2)
|
|
};
|
|
|
|
app.UseWebSockets(webSocketOptions);
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
} |