Skip to content

Commit

Permalink
Print difference in teeconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
hush-hush committed Nov 28, 2024
1 parent c78c5fa commit 265f7a0
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 64 deletions.
4 changes: 3 additions & 1 deletion pkg/config/model/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ func (c *safeConfig) IsSet(key string) bool {
func (c *safeConfig) AllKeysLowercased() []string {
c.Lock()
defer c.Unlock()
return c.Viper.AllKeys()
res := c.Viper.AllKeys()
slices.Sort(res)
return res
}

// Get wraps Viper for concurrent access
Expand Down
9 changes: 6 additions & 3 deletions pkg/config/nodetreemodel/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ func (c *ntmConfig) AllKeysLowercased() []string {
c.RLock()
defer c.RUnlock()

return maps.Keys(c.knownKeys)
res := maps.Keys(c.knownKeys)
slices.Sort(res)
return res
}

func (c *ntmConfig) leafAtPath(key string) LeafNode {
Expand Down Expand Up @@ -585,9 +587,10 @@ func (c *ntmConfig) AddConfigPath(in string) {
defer c.Unlock()

if !filepath.IsAbs(in) {
in, err := filepath.Abs(in)
var err error
in, err = filepath.Abs(in)
if err != nil {
log.Errorf("could not get absolute path for configuration '%s': %s", in, err)
log.Errorf("could not get absolute path for configuration %q: %s", in, err)
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/teeconfig/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ replace (

require (
github.com/DataDog/datadog-agent/pkg/config/model v0.0.0-00010101000000-000000000000
github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3
github.com/DataDog/viper v1.13.5
)

require (
github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
Expand Down
Loading

0 comments on commit 265f7a0

Please sign in to comment.