Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Move INI config parsing to common agent config util #264

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add log message if we detect both config types
sunhay committed Mar 7, 2019
commit b79ff8e34a27742ccb2aafe52c647683d7a8bb4b
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -219,11 +219,15 @@ func NewAgentConfig(iniPath, yamlPath, netYamlPath string) (*AgentConfig, error)
var err error
cfg := NewDefaultAgentConfig()

if util.PathExists(yamlPath) { // For Agents >= 6 we will have a YAML config file to use.
yamlExists, iniExists := util.PathExists(yamlPath), util.PathExists(iniPath)
if yamlExists { // For Agents >= 6 we will have a YAML config file to use.
if iniExists {
log.Infof("both YAML and INI configs detected, ignoring INI and proceeding with YAML")
}
if err := cfg.loadProcessConfig("", yamlPath); err != nil {
return nil, err
}
} else if util.PathExists(iniPath) { // For Agent 5, we will have an INI config file to use
} else if iniExists { // For Agent 5, we will have an INI config file to use
if err := cfg.loadProcessConfig(iniPath, ""); err != nil {
return nil, err
}