Skip to content

Commit

Permalink
fix: Include config file path in the "Agent is disabled " message on …
Browse files Browse the repository at this point in the history
…all platforms. (#1727)
  • Loading branch information
tippmar-nr authored Jun 23, 2023
1 parent 1aa5680 commit 1a56612
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Agent/NewRelic/Agent/Core/Config/ConfigurationLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ public static ValueWithProvenance<string> GetConfigSetting(string key)
value = new ValueWithProvenance<string>(ConfigurationManager.AppSettings[key],
"ConfigurationManager app setting");
}
#else
if (value?.Value == null)
{
var configMgrStatic = new ConfigurationManagerStatic();
var configValue = configMgrStatic.GetAppSetting(key);
if (configValue != null)
value = new ValueWithProvenance<string>(configValue, configMgrStatic.AppSettingsFilePath);
}
#endif
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private AgentManager()
private void AssertAgentEnabled(configuration config)
{
if (!Configuration.AgentEnabled)
throw new Exception(string.Format("The New Relic agent is disabled. Update {0} to re-enable it.", config.AgentEnabledAt));
throw new Exception(string.Format("The New Relic agent is disabled. Update {0} to re-enable it.", config.AgentEnabledAt ?? config.ConfigurationFileName));

if ("REPLACE_WITH_LICENSE_KEY".Equals(Configuration.AgentLicenseKey))
throw new Exception("Please set your license key.");
Expand Down

0 comments on commit 1a56612

Please sign in to comment.