Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the filepath we check for datadog.json to the output of diagnostic tool #6273

Merged
merged 8 commits into from
Dec 9, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ internal static IConfigurationSource ExtractConfigurationSource(this ProcessInfo
}
}

var jsonConfigurationSource = JsonConfigurationSource.TryLoadJsonConfigurationFile(configurationSource, baseDirectory);

var jsonConfigurationSource = JsonConfigurationSource.TryLoadJsonConfigurationFile(configurationSource, baseDirectory, out string jsonDirectory);
chojomok marked this conversation as resolved.
Show resolved Hide resolved
if (jsonConfigurationSource != null)
{
Utils.WriteInfo("Loaded JSON configuration file from: " + jsonDirectory);
configurationSource.Add(jsonConfigurationSource);
}
else
{
Utils.WriteInfo("Did not find JSON configuration file to load from: " + jsonDirectory);
}

return configurationSource;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public JsonConfigurationSource(string json)
_document = JsonDocument.Parse(json, new JsonDocumentOptions { AllowTrailingCommas = true });
}

internal static JsonConfigurationSource? TryLoadJsonConfigurationFile(IConfigurationSource configurationSource, string? baseDirectory)
internal static JsonConfigurationSource? TryLoadJsonConfigurationFile(IConfigurationSource configurationSource, string? baseDirectory, out string configurationFileName)
{
// if environment variable is not set, look for default file name in the current directory
var configurationFileName = configurationSource.GetString(ConfigurationKeys.ConfigurationFileName)
configurationFileName = configurationSource.GetString(ConfigurationKeys.ConfigurationFileName)
?? configurationSource.GetString("DD_DOTNET_TRACER_CONFIG_FILE")
?? Path.Combine(baseDirectory ?? AppDomain.CurrentDomain.BaseDirectory, "datadog.json");

Expand Down
Loading