diff --git a/src/Gateway.Api/Program.cs b/src/Gateway.Api/Program.cs index 842e20c..178ebe7 100644 --- a/src/Gateway.Api/Program.cs +++ b/src/Gateway.Api/Program.cs @@ -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(builder.Configuration.GetSection("Gateway")); builder.Services.ConfigureHttpJsonOptions(options => options.SerializerOptions.Converters.Add(new JsonStringEnumConverter())); builder.Services.AddSingleton();