Implemented node crud and status health check. Added daemon status health endpoint. Refactored project structure. Added sidebar items and ui views

This commit is contained in:
2026-03-05 10:56:52 +00:00
parent 2d1b48b0d4
commit 7c5dc657dc
54 changed files with 1808 additions and 222 deletions

View File

@@ -1,6 +1,12 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Moonlight.Api;
using MoonlightServers.Api.Admin.Nodes;
using MoonlightServers.Api.Infrastructure.Configuration;
using MoonlightServers.Api.Infrastructure.Database;
using MoonlightServers.Api.Infrastructure.Implementations.NodeToken;
using SimplePlugin.Abstractions;
using SerializationContext = MoonlightServers.Shared.SerializationContext;
@@ -17,5 +23,28 @@ public class Startup : MoonlightPlugin
{
options.JsonSerializerOptions.TypeInfoResolverChain.Add(SerializationContext.Default);
});
builder.Services.AddScoped(typeof(DatabaseRepository<>));
builder.Services.AddDbContext<DataContext>();
builder.Services.AddHostedService<DbMigrationService>();
builder.Services.AddSingleton<NodeService>();
var nodeTokenOptions = new NodeTokenOptions();
builder.Configuration.Bind("Moonlight:Servers:NodeToken", nodeTokenOptions);
builder.Services
.AddAuthentication()
.AddScheme<NodeTokenSchemeOptions, NodeTokenSchemeHandler>(NodeTokenSchemeHandler.SchemeName, options =>
{
options.LookupCacheL1Expiry = nodeTokenOptions.LookupCacheL1Expiry;
options.LookupCacheL2Expiry = nodeTokenOptions.LookupCacheL2Expiry;
});
builder.Logging.AddFilter(
"MoonlightServers.Api.Infrastructure.Implementations.NodeToken.NodeTokenSchemeHandler",
LogLevel.Warning
);
}
}