Files
h-school/src/HSchool.AppHost/AppHost.cs
T

34 lines
1.2 KiB
C#

using Microsoft.Extensions.Configuration;
var builder = DistributedApplication.CreateBuilder(args);
var server = builder.AddProject<Projects.HSchool_Server>("server")
.WithHttpHealthCheck("/health")
.WithExternalHttpEndpoints();
// Integration tests and CI run headless: no Node, no dev server, just the game server.
var headless = builder.Configuration.GetValue("HSchool:Headless", false);
if (headless)
{
// Unique folder per AppHost boot so a crashed previous run cannot fill the school limit.
var saves = Path.Combine(Path.GetTempPath(), "h-school-tests", Guid.NewGuid().ToString("N"));
server
.WithEnvironment("Simulation__SavesDirectory", saves)
.WithEnvironment("HSchool__AllowSaveReload", "true")
.WithEnvironment("HSchool__AlphaPassword", "test-alpha")
.WithEnvironment("SwarmUi__BaseUrl", "");
}
if (!headless)
{
var client = builder.AddViteApp("client", "../HSchool.Client")
.WithReference(server)
.WaitFor(server);
// On publish the built client is copied into the server image and served from wwwroot.
server.PublishWithContainerFiles(client, "wwwroot");
}
builder.Build().Run();