POC big step
Some checks failed
Build, Push and Run Container / build (push) Failing after 33s

This commit is contained in:
2025-08-12 15:37:07 +02:00
parent efbcbd0915
commit 183d71e203
12 changed files with 12644 additions and 13 deletions

View File

@@ -1,31 +1,45 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using ProofOfConcept.Services;
using ProofOfConcept.Utilities;
var builder = WebApplication.CreateSlimBuilder(args);
// Load static web assets manifest (referenced libs + your wwwroot)
builder.WebHost.UseStaticWebAssets();
// builder.Services.ConfigureHttpJsonOptions(options => { options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); });
// Add services
builder.Services.AddOpenApi();
builder.Services.AddMediator();
builder.Services.AddMemoryCache();
builder.Services.AddHybridCache();
builder.Services.AddHttpClient();
builder.Services.AddRazorPages();
// Add own services
builder.Services.AddSingleton<IMessageProcessor, MessageProcessor>();
builder.Services.AddTransient<TeslaAuthenticatorService>();
// Add hosted services
builder.Services.AddHostedService<MQTTServer>();
builder.Services.AddHostedService<MQTTClient>();
var app = builder.Build();
//Build app
WebApplication app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
app.MapGet("/GetPartnerAuthenticationToken", ([FromServices] TeslaAuthenticatorService service) => service.AcquirePartnerAuthenticationTokenAsync());
app.MapGet("/CheckRegisteredApplication", ([FromServices] TeslaAuthenticatorService service) => service.CheckApplicationRegistrationAsync());
app.MapGet("/RegisterApplication", ([FromServices] TeslaAuthenticatorService service) => service.RegisterApplicationAsync());
}
//Map tesla required public key file
app.MapGet("/.well-known/appspecific/com.tesla.3p.public-key.pem", (IMemoryCache memoryCache) => memoryCache.GetOrCreateAsync("publicKeyCert", async (_) => await File.ReadAllTextAsync("Resources/Signature/public-key.pem")));
//Map static assets
app.MapStaticAssets();
//Map an under constrcution page...
app.Map("/", ()=> "Under construction...");
app.MapRazorPages();
app.Run();