Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.

This commit is contained in:
StellaOps Bot
2025-12-26 21:54:17 +02:00
parent 335ff7da16
commit c2b9cd8d1f
3717 changed files with 264714 additions and 48202 deletions

View File

@@ -0,0 +1,101 @@
// ----------------------------------------------------------------------------
// Examples.MultiTransport.Gateway
//
// Demonstrates a production-ready API Gateway that supports multiple transports:
// - InMemory (development/testing)
// - TCP (high-performance internal communication)
// - TLS/mTLS (secure communication with certificate auth)
// - RabbitMQ (distributed, queue-based messaging)
//
// The gateway aggregates OpenAPI specs from all connected microservices,
// handles routing decisions, authorization, and request dispatch.
// ----------------------------------------------------------------------------
using StellaOps.Router.Gateway;
using StellaOps.Router.Gateway.Authorization;
using StellaOps.Router.Gateway.DependencyInjection;
using StellaOps.Router.Config;
using StellaOps.Router.Transport.InMemory;
var builder = WebApplication.CreateBuilder(args);
// ----------------------------------------------------------------------------
// Router Configuration
// ----------------------------------------------------------------------------
builder.Services.AddRouterConfig(options =>
{
options.ConfigPath = "router.yaml";
options.EnableHotReload = true; // Hot-reload config changes without restart
});
// ----------------------------------------------------------------------------
// Gateway Core Services
// ----------------------------------------------------------------------------
builder.Services.AddRouterGateway(builder.Configuration);
// ----------------------------------------------------------------------------
// Transport Registration
// The gateway accepts connections from microservices using any transport
// ----------------------------------------------------------------------------
// InMemory: Zero-latency for local development and testing
builder.Services.AddInMemoryTransport();
// Additional transports can be enabled when infrastructure is available:
//
// TCP: High-performance binary protocol for internal services
// builder.Services.AddTcpTransportServer(options => { options.Port = 5100; });
//
// TLS: Encrypted communication with optional mutual TLS
// builder.Services.AddTlsTransportServer(options =>
// {
// options.Port = 5101;
// options.RequireClientCertificate = false;
// });
//
// RabbitMQ: Distributed messaging for cross-datacenter communication
// builder.Services.AddRabbitMqTransportServer(options =>
// {
// options.HostName = "localhost";
// options.Port = 5672;
// });
// ----------------------------------------------------------------------------
// Authorization - No-op for demo, integrate with Authority module in production
// ----------------------------------------------------------------------------
builder.Services.AddNoOpAuthorityIntegration();
builder.Services.AddAuthentication();
// ----------------------------------------------------------------------------
// OpenAPI / Swagger
// ----------------------------------------------------------------------------
builder.Services.AddEndpointsApiExplorer();
var app = builder.Build();
// ----------------------------------------------------------------------------
// Middleware Pipeline
// ----------------------------------------------------------------------------
app.UseForwardedHeaders();
app.UseAuthentication();
app.UseClaimsAuthorization();
// Aggregated OpenAPI from all microservices
app.MapRouterOpenApi();
// Health and readiness endpoints
app.MapGet("/health", () => Results.Ok(new { status = "healthy", timestamp = DateTime.UtcNow }));
app.MapGet("/ready", () => Results.Ok(new { ready = true }));
// Router gateway - handles all routing decisions and request dispatch
app.UseRouterGateway();
Console.WriteLine("Multi-Transport Gateway starting...");
Console.WriteLine("Transports enabled: InMemory (dev)");
Console.WriteLine("Configure additional transports (TCP, TLS, RabbitMQ) as needed");
app.Run();
namespace Examples.MultiTransport.Gateway
{
public partial class Program { }
}