* Avoid null endpoint DTO metadata in tests * Enforce console logs hub read permission * Remove unused console logs hub import * Support mapped endpoint metadata in auth tests * Reduce console log capture throughput impact * Address Copilot console logs review * Refactor task scheduling to support tenant-level background work and enhance logging functionality. * Introduce ConsoleStreamHook for stdout/stderr tee and enhance logging validation. Adjust test cases and startup warnings for distributed lock provider usage. * Refactor console logging pipeline with capture optimization and new ConsoleLogsHost; update tests accordingly. * Add Ansi SGR parser for console logs and associated unit tests * Remove ANSI color renderings and parsers; integrate ConsoleLogScopeAccessor for improved logging context with workflow instance ID support. * Address console logs code quality feedback * Address PR review feedback * Preserve console logs extension points * Stabilize console logs host lifecycle * Address final automated review comments * Tighten console log capture shutdown * Address console log review feedback * Address follow-up review feedback * Cover final review feedback * Avoid recursive console provider initialization * Guard console host lease shutdown * Preserve console log scope and provider lifetime * Correlate console log scope fallback * Tighten console scope correlation * Expose host services during provider construction * Redact ANSI-normalized console lines
72 lines
2.5 KiB
C#
72 lines
2.5 KiB
C#
using CShells.AspNetCore.Configuration;
|
|
using CShells.AspNetCore.Extensions;
|
|
using CShells.DependencyInjection;
|
|
using Elsa.Diagnostics.ConsoleLogs.Extensions;
|
|
using Elsa.Diagnostics.ConsoleLogs.Services;
|
|
using Elsa.ModularServer.Web;
|
|
using Elsa.ModularServer.Web.Catalog;
|
|
using Elsa.ShellFeatures;
|
|
using Elsa.Workflows.Api.ShellFeatures;
|
|
using Elsa.Workflows.Management.ShellFeatures;
|
|
using Elsa.Workflows.Runtime.Distributed.ShellFeatures;
|
|
using Elsa.Workflows.Runtime.ShellFeatures;
|
|
using Elsa.Workflows.ShellFeatures;
|
|
using Nuplane;
|
|
using Nuplane.Loading.Hosting.Builder;
|
|
using Nuplane.Sources.Directory.Configuration;
|
|
|
|
// Install the console stream tee as early as possible — before WebApplication.CreateBuilder and
|
|
// any logger provider construction — so that downstream loggers (Microsoft.Extensions.Logging.Console,
|
|
// Kestrel/Hosting loggers, etc.) capture our tee writer instead of the raw Console.Out / Console.Error.
|
|
ConsoleStreamHook.Install();
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
var services = builder.Services;
|
|
var configuration = builder.Configuration;
|
|
|
|
// Console output is a single process-wide resource; the capture pipeline is owned by the root host so
|
|
// every shell's diagnostics endpoints (REST + SignalR) read from the same in-memory ring buffer.
|
|
services.AddConsoleLogsHost();
|
|
|
|
var nuplaneConfiguration = configuration.GetSection("Nuplane");
|
|
|
|
services.AddNuplane(nuplaneConfiguration, nuplane =>
|
|
{
|
|
nuplane.AddDirectoryFeedsFromConfiguration(nuplaneConfiguration);
|
|
nuplane.AutoloadPackages(nuplaneConfiguration.GetSection("Loading"));
|
|
nuplane.OnPackagesChanged<MyPackageObserver>();
|
|
});
|
|
|
|
services.AddSingleton<NuplaneAssemblyProvider>();
|
|
|
|
builder.AddShells(shells => shells
|
|
.WithHostAssemblies()
|
|
.WithAssemblyProvider<NuplaneAssemblyProvider>()
|
|
.WithConfigurationProvider(configuration)
|
|
.WithWebRouting(options => options.EnablePathRouting = true)
|
|
.WithAuthenticationAndAuthorization()
|
|
.ConfigureAllShells(shell =>
|
|
{
|
|
shell.WithFeatures(
|
|
typeof(ElsaFeature),
|
|
typeof(WorkflowManagementFeature),
|
|
typeof(WorkflowRuntimeFeature),
|
|
typeof(WorkflowsFeature),
|
|
typeof(DistributedRuntimeFeature),
|
|
typeof(WorkflowsApiFeature));
|
|
}));
|
|
|
|
services.AddSingleton<PluginCatalog>();
|
|
services.AddHealthChecks();
|
|
|
|
services.AddAuthentication();
|
|
services.AddAuthorization();
|
|
|
|
var app = builder.Build();
|
|
|
|
app.MapHealthChecks("/");
|
|
app.MapShells();
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
app.MapSampleCatalog();
|
|
app.Run(); |