First Commit
This commit is contained in:
parent
bb40883c7d
commit
696158848f
18 changed files with 787 additions and 0 deletions
50
StitchATon/Program.cs
Normal file
50
StitchATon/Program.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System.Text.Json;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using StitchATon.Services;
|
||||
using StitchATon.Utility;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder( args );
|
||||
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var path = Environment.GetEnvironmentVariable( "ASSET_PATH_RO" );
|
||||
if( path == null )
|
||||
throw new ArgumentException("Please supply the directory path on ASSET_PATH_RO env var");
|
||||
|
||||
// Image Loader
|
||||
builder.Services.AddSingleton( new ImageProvider.Config(
|
||||
path,
|
||||
720,
|
||||
55,
|
||||
31) );
|
||||
builder.Services.AddSingleton<ImageProvider>();
|
||||
|
||||
// FIFO named pipe pool
|
||||
builder.Services.AddSingleton<ObjectPool<PngNamedPipe>>( new DefaultObjectPool<PngNamedPipe>(
|
||||
new DefaultPooledObjectPolicy<PngNamedPipe>(),
|
||||
10 ) );
|
||||
builder.Services.AddControllers().AddJsonOptions( options =>
|
||||
{
|
||||
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
|
||||
options.JsonSerializerOptions.WriteIndented = true;
|
||||
}
|
||||
|
||||
);
|
||||
builder.Logging.AddConsole();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if( app.Environment.IsDevelopment() )
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseCors();
|
||||
app.UseRouting();
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
Loading…
Add table
Add a link
Reference in a new issue