mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-25 07:12:40 +00:00
Fixed: Ensure default config file on starting app
(cherry picked from commit 5326a102e23eacfc1132eb544a92af737a531df5)
This commit is contained in:
parent
cb3d6d7387
commit
ed2d127240
2 changed files with 5 additions and 2 deletions
|
@ -24,6 +24,7 @@ public interface IConfigFileProvider : IHandleAsync<ApplicationStartedEvent>,
|
|||
{
|
||||
Dictionary<string, object> GetConfigDictionary();
|
||||
void SaveConfigDictionary(Dictionary<string, object> configValues);
|
||||
void EnsureDefaultConfigFile();
|
||||
|
||||
string BindAddress { get; }
|
||||
int Port { get; }
|
||||
|
@ -251,7 +252,7 @@ public bool GetValueBoolean(string key, bool 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)
|
||||
|
@ -310,7 +311,7 @@ public void SetValue(string key, Enum value)
|
|||
SetValue(key, value.ToString().ToLower());
|
||||
}
|
||||
|
||||
private void EnsureDefaultConfigFile()
|
||||
public void EnsureDefaultConfigFile()
|
||||
{
|
||||
if (!File.Exists(_configFile))
|
||||
{
|
||||
|
|
|
@ -225,6 +225,8 @@ public void Configure(IApplicationBuilder app,
|
|||
appFolderFactory.Register();
|
||||
pidFileProvider.Write();
|
||||
|
||||
configFileProvider.EnsureDefaultConfigFile();
|
||||
|
||||
reconfigureLogging.Reconfigure();
|
||||
|
||||
EnsureSingleInstance(false, startupContext, singleInstancePolicy);
|
||||
|
|
Loading…
Reference in a new issue