- Implemented CanonJson class for deterministic JSON serialization and hashing. - Added unit tests for CanonJson functionality, covering various scenarios including key sorting, handling of nested objects, arrays, and special characters. - Created project files for the Canonical JSON library and its tests, including necessary package references. - Added README.md for library usage and API reference. - Introduced RabbitMqIntegrationFactAttribute for conditional RabbitMQ integration tests.
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
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 from YAML
|
|
builder.Services.AddRouterConfig(options =>
|
|
{
|
|
options.ConfigPath = "router.yaml";
|
|
options.EnableHotReload = true;
|
|
});
|
|
|
|
// Router gateway services
|
|
builder.Services.AddRouterGateway(builder.Configuration);
|
|
|
|
// In-memory transport for demo (can switch to TCP/TLS for production)
|
|
builder.Services.AddInMemoryTransport();
|
|
|
|
// Authority integration (no-op for demo)
|
|
builder.Services.AddNoOpAuthorityIntegration();
|
|
|
|
// Required for app.UseAuthentication() even when running without a real auth scheme (demo/tests).
|
|
builder.Services.AddAuthentication();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Middleware pipeline
|
|
app.UseForwardedHeaders();
|
|
app.UseAuthentication();
|
|
app.UseClaimsAuthorization();
|
|
|
|
// Map OpenAPI endpoints
|
|
app.MapRouterOpenApi();
|
|
|
|
// Simple health endpoint
|
|
app.MapGet("/health", () => Results.Ok(new { status = "healthy" }));
|
|
|
|
// Router gateway middleware (endpoint resolution, routing decision, dispatch)
|
|
app.UseRouterGateway();
|
|
|
|
app.Run();
|
|
|
|
// Partial class for WebApplicationFactory integration testing
|
|
namespace Examples.Gateway
|
|
{
|
|
public partial class Program { }
|
|
}
|