Fix published web UI content root

This commit is contained in:
jhartworks committed 2026-10-08 12:33:17 +02:00
1 parent b31e9a7261
commit d9165a60ff
1 file changed
+7
+7
View File
@@ -4,7 +4,14 @@ using Gateway.Api.Domain;
using Gateway.Api.Options;
using Gateway.Api.Services;
// The service keeps its mutable data in /var/lib/seiugw on NixOS. Static web
// assets, however, are published beside this executable in the immutable Nix
// store. Explicitly use the executable directory as the content/web root so
// the web UI is available no matter which working directory systemd uses.
var applicationRoot = AppContext.BaseDirectory;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseContentRoot(applicationRoot);
builder.WebHost.UseWebRoot(Path.Combine(applicationRoot, "wwwroot"));
builder.Services.Configure<GatewayOptions>(builder.Configuration.GetSection("Gateway"));
builder.Services.ConfigureHttpJsonOptions(options => options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()));
builder.Services.AddSingleton<GatewayDatabase>();