1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Fixed: Catch InvalidDataException during initial config to prevent boot loop

[Common]
This commit is contained in:
Qstick 2023-01-21 12:54:37 -06:00
parent 6845eaa9b2
commit fb25e5d577

View File

@ -219,12 +219,21 @@ public static ApplicationModes GetApplicationMode(IStartupContext startupContext
private static IConfiguration GetConfiguration(StartupContext context)
{
var appFolder = new AppFolderInfo(context);
var configPath = appFolder.GetConfigPath();
try
{
return new ConfigurationBuilder()
.AddXmlFile(appFolder.GetConfigPath(), optional: true, reloadOnChange: false)
.AddXmlFile(configPath, optional: true, reloadOnChange: false)
.AddInMemoryCollection(new List<KeyValuePair<string, string>> { new ("dataProtectionFolder", appFolder.GetDataProtectionPath()) })
.AddEnvironmentVariables()
.Build();
}
catch (InvalidDataException ex)
{
throw new InvalidConfigFileException($"{configPath} is corrupt or invalid. Please delete the config file and Radarr will recreate it.", ex);
}
}
private static string BuildUrl(string scheme, string bindAddress, int port)
{