Use startup configuration to set the default redirect path

This commit is contained in:
Mark Monteiro 2020-03-15 13:01:05 +01:00
parent a9c1ff9119
commit 420e3619fb

View File

@ -278,7 +278,7 @@ namespace Jellyfin.Server
} }
} }
}) })
.ConfigureAppConfiguration(config => config.ConfigureAppConfiguration(appPaths)) .ConfigureAppConfiguration(config => config.ConfigureAppConfiguration(appPaths, startupConfig))
.UseSerilog() .UseSerilog()
.ConfigureServices(services => .ConfigureServices(services =>
{ {
@ -499,11 +499,11 @@ namespace Jellyfin.Server
.Build(); .Build();
} }
private static IConfigurationBuilder ConfigureAppConfiguration(this IConfigurationBuilder config, IApplicationPaths appPaths) private static IConfigurationBuilder ConfigureAppConfiguration(this IConfigurationBuilder config, IApplicationPaths appPaths, IConfiguration startupConfig = null)
{ {
// Use the swagger API page as the default redirect path if not hosting the jellyfin-web content // Use the swagger API page as the default redirect path if not hosting the jellyfin-web content
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration; var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
if (string.IsNullOrEmpty(appPaths.WebPath)) if (startupConfig != null && startupConfig.NoWebContent())
{ {
inMemoryDefaultConfig[HttpListenerHost.DefaultRedirectKey] = "swagger/index.html"; inMemoryDefaultConfig[HttpListenerHost.DefaultRedirectKey] = "swagger/index.html";
} }