mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
Fixed: Catch InvalidDataException during initial config to prevent boot loop
[Common]
This commit is contained in:
parent
64c5bee830
commit
94d7f56743
1 changed files with 14 additions and 5 deletions
|
@ -211,11 +211,20 @@ namespace NzbDrone.Host
|
||||||
private static IConfiguration GetConfiguration(StartupContext context)
|
private static IConfiguration GetConfiguration(StartupContext context)
|
||||||
{
|
{
|
||||||
var appFolder = new AppFolderInfo(context);
|
var appFolder = new AppFolderInfo(context);
|
||||||
return new ConfigurationBuilder()
|
var configPath = appFolder.GetConfigPath();
|
||||||
.AddXmlFile(appFolder.GetConfigPath(), optional: true, reloadOnChange: false)
|
|
||||||
.AddInMemoryCollection(new List<KeyValuePair<string, string>> { new ("dataProtectionFolder", appFolder.GetDataProtectionPath()) })
|
try
|
||||||
.AddEnvironmentVariables()
|
{
|
||||||
.Build();
|
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 Lidarr will recreate it.", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildUrl(string scheme, string bindAddress, int port)
|
private static string BuildUrl(string scheme, string bindAddress, int port)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue