Skip to content

Commit

Permalink
fix for #76 - not checking whether HOME env variable is defined befor…
Browse files Browse the repository at this point in the history
…e using it
  • Loading branch information
clemensv committed Aug 30, 2024
1 parent 9e64cc3 commit dae5653
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Microsoft.Azure.Relay.Bridge/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,10 @@ public static Config LoadConfig(CommandLineSettings commandLineSettings)

if (string.IsNullOrEmpty(commandLineSettings.ConfigFile))
{
string homeDir = Environment.GetEnvironmentVariable("HOME");
string userConfigFileName =
(Environment.OSVersion.Platform == PlatformID.Unix) ?
Path.Combine(Environment.GetEnvironmentVariable("HOME"), $".{azbridge}/{azbridge}_config.yml") :
(Environment.OSVersion.Platform == PlatformID.Unix && !string.IsNullOrEmpty(homeDir)) ?
Path.Combine(homeDir, $".{azbridge}/{azbridge}_config.yml") :
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), $"{azbridge}\\{azbridge}_config.yml");

Config userConfig = LoadConfigFile(userConfigFileName);
Expand Down

0 comments on commit dae5653

Please sign in to comment.