Proof Of Concept initial
Adds initial files for a proof-of-concept project, including Dockerfile, .gitignore, project files, and MQTT-related services. This commit sets up the basic structure and configuration for exploring and validating the core concepts of the project.
This commit is contained in:
31
Source/ProofOfConcept/Program.cs
Normal file
31
Source/ProofOfConcept/Program.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using ProofOfConcept.Services;
|
||||
|
||||
var builder = WebApplication.CreateSlimBuilder(args);
|
||||
|
||||
// builder.Services.ConfigureHttpJsonOptions(options => { options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); });
|
||||
|
||||
builder.Services.AddOpenApi();
|
||||
builder.Services.AddMediator();
|
||||
builder.Services.AddMemoryCache();
|
||||
builder.Services.AddHybridCache();
|
||||
|
||||
builder.Services.AddSingleton<IMessageProcessor, MessageProcessor>();
|
||||
|
||||
builder.Services.AddHostedService<MQTTServer>();
|
||||
builder.Services.AddHostedService<MQTTClient>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
//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 an under constrcution page...
|
||||
app.Map("/", ()=> "Under construction...");
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user