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:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user