Fixed: Ensure default config file on starting app
(cherry picked from commit e747af9f448368e2add0d2869a3749efa9e93ae0)
This commit is contained in:
parent
69ed531850
commit
5326a102e2
|
@ -24,6 +24,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
{
|
{
|
||||||
Dictionary<string, object> GetConfigDictionary();
|
Dictionary<string, object> GetConfigDictionary();
|
||||||
void SaveConfigDictionary(Dictionary<string, object> configValues);
|
void SaveConfigDictionary(Dictionary<string, object> configValues);
|
||||||
|
void EnsureDefaultConfigFile();
|
||||||
|
|
||||||
string BindAddress { get; }
|
string BindAddress { get; }
|
||||||
int Port { get; }
|
int Port { get; }
|
||||||
|
@ -254,7 +255,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
|
|
||||||
public T GetValueEnum<T>(string key, T defaultValue, bool persist = true)
|
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)
|
public string GetValue(string key, object defaultValue, bool persist = true)
|
||||||
|
@ -313,7 +314,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
SetValue(key, value.ToString().ToLower());
|
SetValue(key, value.ToString().ToLower());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnsureDefaultConfigFile()
|
public void EnsureDefaultConfigFile()
|
||||||
{
|
{
|
||||||
if (!File.Exists(_configFile))
|
if (!File.Exists(_configFile))
|
||||||
{
|
{
|
||||||
|
|
|
@ -211,6 +211,8 @@ namespace NzbDrone.Host
|
||||||
appFolderFactory.Register();
|
appFolderFactory.Register();
|
||||||
pidFileProvider.Write();
|
pidFileProvider.Write();
|
||||||
|
|
||||||
|
configFileProvider.EnsureDefaultConfigFile();
|
||||||
|
|
||||||
reconfigureLogging.Reconfigure();
|
reconfigureLogging.Reconfigure();
|
||||||
|
|
||||||
EnsureSingleInstance(false, startupContext, singleInstancePolicy);
|
EnsureSingleInstance(false, startupContext, singleInstancePolicy);
|
||||||
|
|
Loading…
Reference in New Issue