Skip to content

Commit

Permalink
feat: agent config plugin serialising only public fields
Browse files Browse the repository at this point in the history
  • Loading branch information
varas committed Nov 24, 2020
1 parent 9d10258 commit b70d2c8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/plugins/agent_config.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b70d2c8

Please sign in to comment.