diff --git a/src/Microsoft.Azure.Relay.Bridge/Configuration/Config.cs b/src/Microsoft.Azure.Relay.Bridge/Configuration/Config.cs index 47ed0d2..5284aa5 100644 --- a/src/Microsoft.Azure.Relay.Bridge/Configuration/Config.cs +++ b/src/Microsoft.Azure.Relay.Bridge/Configuration/Config.cs @@ -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);