-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "setting security agent config file instead of merging because…
… Viper only supports 1 config file per viper instance" This reverts commit 8e6736d.
- Loading branch information
1 parent
22d53c9
commit 8420168
Showing
2 changed files
with
49 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
package config | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
aconfig "github.com/DataDog/datadog-agent/pkg/config" | ||
"github.com/DataDog/datadog-agent/pkg/util/log" | ||
) | ||
|
||
// Merge will merge the security-agent configuration into the existing datadog configuration | ||
func Merge(configPaths []string) error { | ||
for _, configPath := range configPaths { | ||
if f, err := os.Open(configPath); err == nil { | ||
err = aconfig.Datadog.MergeConfig(f) | ||
_ = f.Close() | ||
if err != nil { | ||
return fmt.Errorf("error merging %s config file: %w", configPath, err) | ||
} | ||
} else { | ||
log.Infof("no config exists at %s, ignoring...", configPath) | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters