POSTIT_SETTINGS_JSON env var
Some checks failed
Dotnet build and test / build (pull_request) Failing after 10m54s
Some checks failed
Dotnet build and test / build (pull_request) Failing after 10m54s
This commit is contained in:
parent
f7e1f4a736
commit
1af839e14e
1 changed files with 12 additions and 6 deletions
|
|
@ -15,7 +15,7 @@ namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public partial class Settings : ViewModelBase
|
public partial class Settings : ViewModelBase
|
||||||
{
|
{
|
||||||
const string SettingsFileName = "postit-settings.json";
|
public string SettingsFileName {get; private set;} = "postit-settings.json";
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial AuthenticationSettings Authentication { get; set; } = new();
|
public partial AuthenticationSettings Authentication { get; set; } = new();
|
||||||
|
|
@ -251,12 +251,18 @@ public partial class Settings : ViewModelBase
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Environment.GetEnvironmentVariable("POSTIT_SETTINGS_JSON") is string envJson
|
||||||
|
&& !string.IsNullOrWhiteSpace(envJson))
|
||||||
|
{
|
||||||
|
Console.WriteLine("🔎 Loading settings from POSTIT_SETTINGS_JSON environment variable.");
|
||||||
|
ApplyJson(envJson, "POSTIT_SETTINGS_JSON");
|
||||||
|
Loaded = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
string configDir = Path.Combine(
|
string configDir = Path.Combine(
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
"PostIt"
|
"PostIt"
|
||||||
);
|
);
|
||||||
Directory.CreateDirectory(configDir);
|
|
||||||
|
|
||||||
string configPath = Path.Combine(configDir, SettingsFileName);
|
string configPath = Path.Combine(configDir, SettingsFileName);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue