Refactored startup. Updated usings. Removed dockerignore
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/.idea
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
**/storage
|
||||
**/compose.yml
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
# For the people who run moonlight inside the main repo with the relative data path
|
||||
data
|
||||
@@ -1,9 +1,28 @@
|
||||
using Moonlight.ApiServer;
|
||||
using Moonlight.ApiServer.Runtime;
|
||||
|
||||
var startup = new Startup();
|
||||
|
||||
var pluginLoader = new PluginLoader();
|
||||
pluginLoader.Initialize();
|
||||
|
||||
/*
|
||||
await startup.Run(args, pluginLoader.Instances);
|
||||
|
||||
*/
|
||||
|
||||
var cs = new CleanStartup();
|
||||
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
||||
await cs.AddMoonlight(builder, args, pluginLoader.Instances);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
await cs.AddMoonlight(app, args, pluginLoader.Instances);
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseWebAssemblyDebugging();
|
||||
|
||||
app.UseBlazorFrameworkFiles();
|
||||
app.UseStaticFiles();
|
||||
|
||||
|
||||
await app.RunAsync();
|
||||
132
Moonlight.ApiServer/CleanStartup.cs
Normal file
132
Moonlight.ApiServer/CleanStartup.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moonlight.ApiServer.Configuration;
|
||||
using Moonlight.ApiServer.Plugins;
|
||||
|
||||
namespace Moonlight.ApiServer;
|
||||
|
||||
public class CleanStartup
|
||||
{
|
||||
// Logger
|
||||
private ILogger Logger;
|
||||
|
||||
// Configuration
|
||||
private AppConfiguration Configuration;
|
||||
|
||||
// WebApplication Stuff
|
||||
private WebApplication WebApplication;
|
||||
private WebApplicationBuilder WebApplicationBuilder;
|
||||
|
||||
public async Task AddMoonlight(
|
||||
WebApplicationBuilder builder,
|
||||
string[] args,
|
||||
IPluginStartup[]? plugins = null
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task AddMoonlight(
|
||||
WebApplication application,
|
||||
string[] args,
|
||||
IPluginStartup[]? plugins = null
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
#region Misc
|
||||
|
||||
private Task PrintVersion()
|
||||
{
|
||||
// Fancy start console output... yes very fancy :>
|
||||
var rainbow = new Crayon.Rainbow(0.5);
|
||||
foreach (var c in "Moonlight")
|
||||
{
|
||||
Console.Write(
|
||||
rainbow
|
||||
.Next()
|
||||
.Bold()
|
||||
.Text(c.ToString())
|
||||
);
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task CreateStorage()
|
||||
{
|
||||
Directory.CreateDirectory("storage");
|
||||
Directory.CreateDirectory(Path.Combine("storage", "logs"));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Base
|
||||
|
||||
private Task RegisterBase()
|
||||
{
|
||||
WebApplicationBuilder.Services.AutoAddServices<Startup>();
|
||||
WebApplicationBuilder.Services.AddHttpClient();
|
||||
|
||||
WebApplicationBuilder.Services.AddApiExceptionHandler();
|
||||
|
||||
// Add pre-existing services
|
||||
WebApplicationBuilder.Services.AddSingleton(Configuration);
|
||||
|
||||
// Configure controllers
|
||||
var mvcBuilder = WebApplicationBuilder.Services.AddControllers();
|
||||
|
||||
// Add plugin assemblies as application parts
|
||||
foreach (var pluginStartup in PluginStartups.Select(x => x.GetType().Assembly).Distinct())
|
||||
mvcBuilder.AddApplicationPart(pluginStartup.GetType().Assembly);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task UseBase()
|
||||
{
|
||||
WebApplication.UseRouting();
|
||||
WebApplication.UseExceptionHandler();
|
||||
|
||||
if (Configuration.Client.Enable)
|
||||
{
|
||||
if (WebApplication.Environment.IsDevelopment())
|
||||
WebApplication.UseWebAssemblyDebugging();
|
||||
|
||||
WebApplication.UseBlazorFrameworkFiles();
|
||||
WebApplication.UseStaticFiles();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task MapBase()
|
||||
{
|
||||
WebApplication.MapControllers();
|
||||
|
||||
if (Configuration.Client.Enable)
|
||||
WebApplication.MapFallbackToController("Index", "Frontend");
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ConfigureKestrel()
|
||||
{
|
||||
WebApplicationBuilder.WebHost.ConfigureKestrel(kestrelOptions =>
|
||||
{
|
||||
var maxUploadInBytes = ByteConverter
|
||||
.FromMegaBytes(Configuration.Kestrel.UploadLimit)
|
||||
.Bytes;
|
||||
|
||||
kestrelOptions.Limits.MaxRequestBodySize = maxUploadInBytes;
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Moonlight.ApiServer.Services;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Moonlight.ApiServer.Services;
|
||||
using Moonlight.Shared.Http.Requests.Admin.Sys;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using MoonCore.Exceptions;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Moonlight.ApiServer.Services;
|
||||
using Moonlight.Shared.Misc;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoonCore.Exceptions;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
using MoonCore.Helpers;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Moonlight.ApiServer.Interfaces;
|
||||
using Moonlight.ApiServer.Services;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
using Moonlight.ApiServer.Database.Entities;
|
||||
using Moonlight.ApiServer.Interfaces;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Moonlight.ApiServer.Configuration;
|
||||
using Moonlight.ApiServer.Database;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -12,12 +12,6 @@
|
||||
<Folder Include="Database\Migrations\" />
|
||||
<Folder Include="Helpers\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
<Pack>false</Pack>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PackageId>Moonlight.ApiServer</PackageId>
|
||||
<Version>2.1.2</Version>
|
||||
@@ -32,7 +26,6 @@
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.20" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.20" />
|
||||
<PackageReference Include="Hangfire.EntityFrameworkCore" Version="0.7.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.7" />
|
||||
<PackageReference Include="MoonCore" Version="1.9.2" />
|
||||
<PackageReference Include="MoonCore.Extended" Version="1.3.5" />
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Moonlight.ApiServer.Plugins;
|
||||
|
||||
public interface IPluginStartup
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
using Moonlight.ApiServer;
|
||||
|
||||
var startup = new Startup();
|
||||
|
||||
await startup.Run(args);
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoonCore.Attributes;
|
||||
using MoonCore.Helpers;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Moonlight.ApiServer.Interfaces;
|
||||
using System.IO.Compression;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoonCore.Attributes;
|
||||
using MoonCore.Exceptions;
|
||||
using Moonlight.Shared.Http.Responses.Admin.Sys;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using MoonCore.Attributes;
|
||||
using MoonCore.Exceptions;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moonlight.ApiServer.Configuration;
|
||||
using Moonlight.ApiServer.Interfaces;
|
||||
|
||||
|
||||
@@ -2,8 +2,14 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using Hangfire;
|
||||
using Hangfire.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Cors.Infrastructure;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using MoonCore.EnvConfiguration;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
@@ -27,12 +33,11 @@ namespace Moonlight.ApiServer;
|
||||
// Cry about it
|
||||
#pragma warning disable ASP0000
|
||||
|
||||
public class Startup
|
||||
public class StartupX
|
||||
{
|
||||
private string[] Args;
|
||||
|
||||
// Logging
|
||||
private ILoggerProvider[] LoggerProviders;
|
||||
private ILoggerFactory LoggerFactory;
|
||||
private ILogger<Startup> Logger;
|
||||
|
||||
|
||||
66
Moonlight.ApiServer/Startup/CleanStartup.cs
Normal file
66
Moonlight.ApiServer/Startup/CleanStartup.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Moonlight.ApiServer.Configuration;
|
||||
using Moonlight.ApiServer.Plugins;
|
||||
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
// Logger
|
||||
private ILogger Logger;
|
||||
|
||||
// Configuration
|
||||
private AppConfiguration Configuration;
|
||||
|
||||
// WebApplication Stuff
|
||||
private WebApplication WebApplication;
|
||||
private WebApplicationBuilder WebApplicationBuilder;
|
||||
|
||||
public async Task AddMoonlight(
|
||||
WebApplicationBuilder builder,
|
||||
string[] args,
|
||||
IPluginStartup[]? plugins = null
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task AddMoonlight(
|
||||
WebApplication application,
|
||||
string[] args,
|
||||
IPluginStartup[]? plugins = null
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
#region Misc
|
||||
|
||||
private Task PrintVersion()
|
||||
{
|
||||
// Fancy start console output... yes very fancy :>
|
||||
var rainbow = new Crayon.Rainbow(0.5);
|
||||
foreach (var c in "Moonlight")
|
||||
{
|
||||
Console.Write(
|
||||
rainbow
|
||||
.Next()
|
||||
.Bold()
|
||||
.Text(c.ToString())
|
||||
);
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task CreateStorage()
|
||||
{
|
||||
Directory.CreateDirectory("storage");
|
||||
Directory.CreateDirectory(Path.Combine("storage", "logs"));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
6
Moonlight.ApiServer/Startup/Startup.Auth.cs
Normal file
6
Moonlight.ApiServer/Startup/Startup.Auth.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
|
||||
}
|
||||
74
Moonlight.ApiServer/Startup/Startup.Base.cs
Normal file
74
Moonlight.ApiServer/Startup/Startup.Base.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MoonCore.Extended.Extensions;
|
||||
using MoonCore.Extensions;
|
||||
using MoonCore.Helpers;
|
||||
using Moonlight.ApiServer.Plugins;
|
||||
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
private Task RegisterBase(IPluginStartup[] pluginStartups)
|
||||
{
|
||||
WebApplicationBuilder.Services.AutoAddServices<CleanStartup>();
|
||||
WebApplicationBuilder.Services.AddHttpClient();
|
||||
|
||||
WebApplicationBuilder.Services.AddApiExceptionHandler();
|
||||
|
||||
// Add pre-existing services
|
||||
WebApplicationBuilder.Services.AddSingleton(Configuration);
|
||||
|
||||
// Configure controllers
|
||||
var mvcBuilder = WebApplicationBuilder.Services.AddControllers();
|
||||
|
||||
// Add plugin assemblies as application parts
|
||||
foreach (var pluginStartup in pluginStartups.Select(x => x.GetType().Assembly).Distinct())
|
||||
mvcBuilder.AddApplicationPart(pluginStartup.GetType().Assembly);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task UseBase()
|
||||
{
|
||||
WebApplication.UseRouting();
|
||||
WebApplication.UseExceptionHandler();
|
||||
|
||||
if (Configuration.Client.Enable)
|
||||
{
|
||||
if (WebApplication.Environment.IsDevelopment())
|
||||
WebApplication.UseWebAssemblyDebugging();
|
||||
|
||||
WebApplication.UseBlazorFrameworkFiles();
|
||||
WebApplication.UseStaticFiles();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task MapBase()
|
||||
{
|
||||
WebApplication.MapControllers();
|
||||
|
||||
if (Configuration.Client.Enable)
|
||||
WebApplication.MapFallbackToController("Index", "Frontend");
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ConfigureKestrel()
|
||||
{
|
||||
WebApplicationBuilder.WebHost.ConfigureKestrel(kestrelOptions =>
|
||||
{
|
||||
var maxUploadInBytes = ByteConverter
|
||||
.FromMegaBytes(Configuration.Kestrel.UploadLimit)
|
||||
.Bytes;
|
||||
|
||||
kestrelOptions.Limits.MaxRequestBodySize = maxUploadInBytes;
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
6
Moonlight.ApiServer/Startup/Startup.Config.cs
Normal file
6
Moonlight.ApiServer/Startup/Startup.Config.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
|
||||
}
|
||||
6
Moonlight.ApiServer/Startup/Startup.Database.cs
Normal file
6
Moonlight.ApiServer/Startup/Startup.Database.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
|
||||
}
|
||||
6
Moonlight.ApiServer/Startup/Startup.Hangfire.cs
Normal file
6
Moonlight.ApiServer/Startup/Startup.Hangfire.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
|
||||
}
|
||||
6
Moonlight.ApiServer/Startup/Startup.Logging.cs
Normal file
6
Moonlight.ApiServer/Startup/Startup.Logging.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
|
||||
}
|
||||
6
Moonlight.ApiServer/Startup/Startup.Misc.cs
Normal file
6
Moonlight.ApiServer/Startup/Startup.Misc.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
|
||||
}
|
||||
89
Moonlight.ApiServer/Startup/Startup.Plugins.cs
Normal file
89
Moonlight.ApiServer/Startup/Startup.Plugins.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoonCore.Logging;
|
||||
using Moonlight.ApiServer.Plugins;
|
||||
|
||||
namespace Moonlight.ApiServer.Startup;
|
||||
|
||||
public partial class CleanStartup
|
||||
{
|
||||
private IServiceProvider PluginLoadServiceProvider;
|
||||
private IPluginStartup[] PluginStartups;
|
||||
|
||||
private Task InitializePlugins(IPluginStartup[] pluginStartups)
|
||||
{
|
||||
// Create service provider for starting up
|
||||
var serviceCollection = new ServiceCollection();
|
||||
|
||||
serviceCollection.AddSingleton(Configuration);
|
||||
|
||||
serviceCollection.AddLogging(builder =>
|
||||
{
|
||||
builder.ClearProviders();
|
||||
builder.AddAnsiConsole();
|
||||
});
|
||||
|
||||
PluginLoadServiceProvider = serviceCollection.BuildServiceProvider();
|
||||
|
||||
PluginStartups = pluginStartups;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task HookPluginBuild()
|
||||
{
|
||||
foreach (var pluginAppStartup in PluginStartups)
|
||||
{
|
||||
try
|
||||
{
|
||||
await pluginAppStartup.BuildApplication(PluginLoadServiceProvider, WebApplicationBuilder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(
|
||||
"An error occured while processing 'BuildApp' for '{name}': {e}",
|
||||
pluginAppStartup.GetType().FullName,
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HookPluginConfigure()
|
||||
{
|
||||
foreach (var pluginAppStartup in PluginStartups)
|
||||
{
|
||||
try
|
||||
{
|
||||
await pluginAppStartup.ConfigureApplication(PluginLoadServiceProvider, WebApplication);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(
|
||||
"An error occured while processing 'ConfigureApp' for '{name}': {e}",
|
||||
pluginAppStartup.GetType().FullName,
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HookPluginEndpoints()
|
||||
{
|
||||
foreach (var pluginEndpointStartup in PluginStartups)
|
||||
{
|
||||
try
|
||||
{
|
||||
await pluginEndpointStartup.ConfigureEndpoints(PluginLoadServiceProvider, WebApplication);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(
|
||||
"An error occured while processing 'ConfigureEndpoints' for '{name}': {e}",
|
||||
pluginEndpointStartup.GetType().FullName,
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user