From d582607a5ab82accee77217aeeca7c8be91bf5e8 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 21 Jul 2024 15:47:52 +0200 Subject: [PATCH] Add PathBase config option so CDN can be hosted on subpaths. This is only really necessary to fix the HTML builds page, but whatever. Fixes #6 --- Robust.Cdn/Program.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Robust.Cdn/Program.cs b/Robust.Cdn/Program.cs index c31f20e..f94284b 100644 --- a/Robust.Cdn/Program.cs +++ b/Robust.Cdn/Program.cs @@ -66,6 +66,15 @@ var app = builder.Build(); +var pathBase = app.Configuration.GetValue("PathBase"); +if (!string.IsNullOrEmpty(pathBase)) +{ + app.Services.GetRequiredService>().LogInformation("Using PathBase: {PathBase}", pathBase); + app.UsePathBase(pathBase); +} + +app.UseRouting(); + // Make sure SQLite cleanly shuts down. app.Lifetime.ApplicationStopped.Register(SqliteConnection.ClearAllPools);