mirror of
https://github.com/Readarr/Readarr
synced 2025-12-14 12:24:49 +01:00
Fixed: Catch InvalidDataException during initial config to prevent boot loop
[Common]
This commit is contained in:
parent
2bde9d13dd
commit
f16bd435db
1 changed files with 14 additions and 5 deletions
|
|
@ -215,11 +215,20 @@ public static ApplicationModes GetApplicationMode(IStartupContext startupContext
|
|||
private static IConfiguration GetConfiguration(StartupContext context)
|
||||
{
|
||||
var appFolder = new AppFolderInfo(context);
|
||||
return new ConfigurationBuilder()
|
||||
.AddXmlFile(appFolder.GetConfigPath(), optional: true, reloadOnChange: false)
|
||||
.AddInMemoryCollection(new List<KeyValuePair<string, string>> { new ("dataProtectionFolder", appFolder.GetDataProtectionPath()) })
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
var configPath = appFolder.GetConfigPath();
|
||||
|
||||
try
|
||||
{
|
||||
return new ConfigurationBuilder()
|
||||
.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 Readarr will recreate it.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static string BuildUrl(string scheme, string bindAddress, int port)
|
||||
|
|
|
|||
Loading…
Reference in a new issue