From b70d2c834473b98678a1369c12d48bef556ad5dc Mon Sep 17 00:00:00 2001 From: varas Date: Tue, 24 Nov 2020 18:59:14 +0100 Subject: [PATCH] feat: agent config plugin serialising only public fields --- pkg/plugins/agent_config.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/plugins/agent_config.go b/pkg/plugins/agent_config.go index ce9bfaab3..bf6a00f79 100644 --- a/pkg/plugins/agent_config.go +++ b/pkg/plugins/agent_config.go @@ -5,6 +5,7 @@ package plugins import ( "github.com/newrelic/infrastructure-agent/pkg/entity" "reflect" + "unicode" "github.com/newrelic/infrastructure-agent/pkg/log" "github.com/sirupsen/logrus" @@ -48,6 +49,16 @@ func (ac *AgentConfigPlugin) Run() { value := reflect.ValueOf(ac.config) for i := 0; i < value.NumField(); i++ { name := value.Type().Field(i).Name + + // serialise only public fields + if len(name) <= 0 { + continue + } + firstLetter := rune(name[0]) + if !unicode.IsUpper(firstLetter) { + continue + } + switch name { case "FilesConfigOn", "DebugLogSec", "OfflineLoggingMode": continue