mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 09:46:30 +00:00
7807f5bc90
configure auto-scan folder and create hls files job WIP
57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using System.Collections.Specialized;
|
|
using Azaion.Repository;
|
|
using Azaion.Repository.DTO;
|
|
using Azaion.Repository.DTO.Configs;
|
|
using Azaion.Video;
|
|
using Microsoft.Extensions.Options;
|
|
using Quartz;
|
|
using Serilog;
|
|
using Serilog.Events;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
|
.Enrich.FromLogContext()
|
|
.WriteTo.Console()
|
|
.WriteTo.File(
|
|
path: "Logs/log.txt",
|
|
rollingInterval: RollingInterval.Day)
|
|
.CreateLogger();
|
|
|
|
builder.Host.UseSerilog();
|
|
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
builder.Services.Configure<FoldersConfig>(builder.Configuration.GetSection(nameof(FoldersConfig)));
|
|
builder.Services.Configure<ConnectionStrings>(builder.Configuration.GetSection(nameof(ConnectionStrings)));
|
|
builder.Services.AddSingleton<IDbFactory, DbFactory>(sp => new DbFactory(sp.GetService<IOptions<ConnectionStrings>>()!.Value.FraudDb!));
|
|
builder.Services.AddScoped<IVideoRepository, VideoRepository>();
|
|
|
|
var connStr = builder.Configuration.Get<ConnectionStrings>();
|
|
|
|
builder.Services.AddQuartz(q =>
|
|
{
|
|
q.SchedulerId = "AzaionScheduler";
|
|
q.SchedulerName = "Azaion Scheduler";
|
|
q.UsePersistentStore(c =>
|
|
{
|
|
c.UseNewtonsoftJsonSerializer();
|
|
c.UseMySql(connStr.FraudDbMsSql);
|
|
});
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.MapControllers();
|
|
app.Run(); |