|
1 | | -using Aspire.Hosting; |
| 1 | +using System; |
2 | 2 |
|
3 | | -var builder = DistributedApplication.CreateBuilder(args); |
| 3 | +// Minimal AppHost shim. |
| 4 | +// This project previously used the .NET Aspire AppHost runtime. That runtime and automatic DAB startup |
| 5 | +// have been removed. To run the portal locally, run the Portal project directly. |
4 | 6 |
|
5 | | -// Make containerized resources optional to avoid requiring DCP when running `dotnet run`. |
6 | | -var skipContainersEnv = Environment.GetEnvironmentVariable("ASPIRE_SKIP_CONTAINERS"); |
7 | | -var skipContainers = string.IsNullOrWhiteSpace(skipContainersEnv) || bool.TryParse(skipContainersEnv, out var val) && val; |
| 7 | +Console.WriteLine("AppHost shim: Aspire AppHost usage removed."); |
| 8 | +Console.WriteLine("Run the Portal directly with: dotnet run --project ..\\src\\Portal\\Portal.csproj"); |
| 9 | +Console.WriteLine("Or use the one-command local script: pwsh -File ..\\..\\scripts\\run-local.ps1"); |
8 | 10 |
|
9 | | -if (!skipContainers) |
10 | | -{ |
11 | | - // Cosmos DB Emulator (for local dev). If you prefer local emulator app, set COSMOS_CONNECTION_STRING externally and skip this container. |
12 | | - var cosmosEmu = builder.AddContainer("cosmos", "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator", tag: "latest") |
13 | | - .WithEnvironment("AZURE_COSMOS_EMULATOR_ENABLE_TELEMETRY", "false") |
14 | | - .WithEnvironment("AZURE_COSMOS_EMULATOR_PARTITION_COUNT", "3") |
15 | | - .WithEnvironment("AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE", "true") |
16 | | - .WithContainerRuntimeArgs("--cap-add=NET_ADMIN") |
17 | | - .WithHttpEndpoint(port: 8085, targetPort: 8081, name: "cosmos"); // maps emulator 8081 -> 8085 on host |
18 | | - |
19 | | - // Connection strings: |
20 | | - // - Inside containers (same Docker/Aspire network): use the container hostname `cosmos` at port 8081. |
21 | | - // - From the host (for local tools like the Seeder): use https://localhost:8085 mapped above. |
22 | | - var cosmosConnForContainers = "AccountEndpoint=https://cosmos:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;"; |
23 | | - var cosmosConnForHost = "AccountEndpoint=https://localhost:8085/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;"; |
24 | | - |
25 | | - var dab = builder.AddContainer("dab", "mcr.microsoft.com/data-api-builder", tag: "latest") |
26 | | - .WithBindMount("..\\dab\\dab-config.json", "/App/dab-config.json") |
27 | | - .WithEnvironment("ASPNETCORE_URLS", "http://+:8082") |
28 | | - // Prefer an explicit COSMOS_CONNECTION_STRING if provided by the user, otherwise default to the container-network connection. |
29 | | - .WithEnvironment("COSMOS_CONNECTION_STRING", Environment.GetEnvironmentVariable("COSMOS_CONNECTION_STRING") ?? cosmosConnForContainers) |
30 | | - // Provide COSMOS_CONNECTION_STRING via environment or user-secrets for DAB to connect to Cosmos |
31 | | - .WithHttpEndpoint(port: 8082, name: "http") |
32 | | - .WithArgs(["dab", "start", "--host", "0.0.0.0", "--config", "/App/dab-config.json"]); |
33 | | -} |
34 | | - |
35 | | -// (Optional) Run Seeder manually: dotnet run --project management-portal/Seeder |
36 | | - |
37 | | -var portal = builder.AddProject("portal", "..\\src\\Portal\\Portal.csproj") |
38 | | - .WithEnvironment("ASPNETCORE_URLS", "http://+:8081") |
39 | | - .WithEnvironment("DAB_GRAPHQL_URL", "http://localhost:8082/graphql") |
40 | | - .WithHttpEndpoint(port: 8081, name: "http"); |
41 | | - |
42 | | -builder.Build().Run(); |
| 11 | +return 0; |
0 commit comments