25c937e41c
Co-authored-by: Copilot <copilot@github.com>
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using Microsoft.Extensions.Hosting;
|
|
using Scalar.Aspire;
|
|
|
|
var builder = DistributedApplication.CreateBuilder(args);
|
|
|
|
#region EXTERNAL CONNECTIONS — OPC infra (postgres, minio)
|
|
// Connection strings are declared in appsettings.Development.json and point at the
|
|
// fdev tenant on the shared OPC platform infra running via OPC/infra/docker-compose.yml.
|
|
var postgresdb = builder.AddConnectionString("postgresdb");
|
|
var minio = builder.AddConnectionString("minio");
|
|
#endregion
|
|
|
|
#region REDIS
|
|
var cache = builder.AddRedis("cache");
|
|
#endregion
|
|
|
|
#region EFCORE MIGRATION WORKER
|
|
var migrations = builder.AddProject<Projects.Clarity_MigrationService>("clarity-migrationservice")
|
|
.WithReference(postgresdb);
|
|
#endregion
|
|
|
|
#region REST API
|
|
var server = builder.AddProject<Projects.Clarity_Server>("server")
|
|
.WithReference(cache)
|
|
.WithReference(postgresdb)
|
|
.WaitFor(cache)
|
|
.WithReference(migrations)
|
|
.WithReference(minio)
|
|
.WaitForCompletion(migrations)
|
|
.WithHttpHealthCheck("/health")
|
|
.WithHttpEndpoint(port: 5416, name: "clarity-http")
|
|
.WithExternalHttpEndpoints();
|
|
#endregion
|
|
|
|
#region REACT
|
|
var webfrontend = builder.AddViteApp("webfrontend", "../frontend")
|
|
.WithReference(server)
|
|
.WaitFor(server)
|
|
.WithEnvironment("VITE_KEYCLOAK_URL", "https://keycloak.clarity.test")
|
|
.WithEnvironment("VITE_KEYCLOAK_REALM", "clarity-fdev-app-clarity-01000000")
|
|
.WithEnvironment("VITE_KEYCLOAK_CLIENT_ID", "clarity-web-app");
|
|
|
|
server.PublishWithContainerFiles(webfrontend, "wwwroot");
|
|
#endregion
|
|
|
|
#region SCALAR API DOCS
|
|
var scalar = builder.AddScalarApiReference();
|
|
scalar
|
|
.WithApiReference(server);
|
|
// .WithApiReference(webfrontend);
|
|
#endregion
|
|
|
|
builder.Build().Run();
|