Fixed: Ensure default config file on starting app

(cherry picked from commit 5326a102e23eacfc1132eb544a92af737a531df5)
This commit is contained in:
Bogdan 2023-04-09 03:55:30 +03:00 committed by Qstick
parent 621acbef9a
commit d0fcac389c
2 changed files with 5 additions and 2 deletions

View File

@ -26,6 +26,7 @@ namespace NzbDrone.Core.Configuration
XDocument LoadConfigFile();
Dictionary<string, object> GetConfigDictionary();
void SaveConfigDictionary(Dictionary<string, object> configValues);
void EnsureDefaultConfigFile();
string BindAddress { get; }
int Port { get; }
@ -253,7 +254,7 @@ namespace NzbDrone.Core.Configuration
public T GetValueEnum<T>(string key, T defaultValue, bool persist = true)
{
return (T)Enum.Parse(typeof(T), GetValue(key, defaultValue), persist);
return (T)Enum.Parse(typeof(T), GetValue(key, defaultValue, persist));
}
public string GetValue(string key, object defaultValue, bool persist = true)
@ -312,7 +313,7 @@ namespace NzbDrone.Core.Configuration
SetValue(key, value.ToString().ToLower());
}
private void EnsureDefaultConfigFile()
public void EnsureDefaultConfigFile()
{
if (!File.Exists(_configFile))
{

View File

@ -224,6 +224,8 @@ namespace NzbDrone.Host
appFolderFactory.Register();
pidFileProvider.Write();
configFileProvider.EnsureDefaultConfigFile();
reconfigureLogging.Reconfigure();
EnsureSingleInstance(false, startupContext, singleInstancePolicy);