Skip to content

Commit

Permalink
rename configMissingOK field to baseConfigMissingOK
Browse files Browse the repository at this point in the history
  • Loading branch information
modernplumbing committed Dec 28, 2022
1 parent feeaab0 commit b5ffc2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions comp/core/config/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Params struct {
// the component's config data.
configLoadSysProbe bool

// securityAgentConfigFilePaths are the paths at which to look for security-aegnt
// securityAgentConfigFilePaths are the paths at which to look for security-agent
// configuration, usually given by the --cfgpath command-line flag.
securityAgentConfigFilePaths []string

Expand All @@ -40,9 +40,9 @@ type Params struct {
// should be evaluated. This is typically false for one-shot commands.
configLoadSecrets bool

// configMissingOK determines whether it is a fatal error if the config
// baseConfigMissingOK determines whether it is a fatal error if the base Datadog config
// file does not exist.
configMissingOK bool
baseConfigMissingOK bool

// defaultConfPath determines the default configuration path.
// if defaultConfPath is empty, then no default configuration path is used.
Expand Down Expand Up @@ -82,6 +82,7 @@ func NewSecurityAgentParams(securityAgentConfigFilePaths []string, options ...fu
params := NewParams("", options...)
params.securityAgentConfigFilePaths = securityAgentConfigFilePaths
params.configLoadSecurityAgent = true
params.baseConfigMissingOK = true
return params
}

Expand All @@ -93,7 +94,7 @@ func WithConfigName(name string) func(*Params) {

func WithConfigMissingOK(v bool) func(*Params) {
return func(b *Params) {
b.configMissingOK = v
b.baseConfigMissingOK = v
}
}

Expand Down Expand Up @@ -144,7 +145,7 @@ func (p Params) ConfigLoadSecrets() bool {
// ConfigMissingOK determines whether it is a fatal error if the config
// file does not exist.
func (p Params) ConfigMissingOK() bool {
return p.configMissingOK
return p.baseConfigMissingOK
}

// ConfigLoadSysProbe determines whether to read the system-probe.yaml into
Expand Down
4 changes: 2 additions & 2 deletions comp/core/config/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func setupConfig(deps dependencies) (*config.Warnings, error) {
confFilePath := deps.Params.confFilePath
configName := deps.Params.configName
withoutSecrets := !deps.Params.configLoadSecrets
failOnMissingFile := !deps.Params.configMissingOK
failOnMissingFile := !deps.Params.baseConfigMissingOK
defaultConfPath := deps.Params.defaultConfPath

if configName != "" {
Expand Down Expand Up @@ -106,7 +106,7 @@ func MergeConfigurationFiles(configName string, configurationFilesArray []string
deps.Params.confFilePath = configurationFilename
deps.Params.configName = ""
deps.Params.configLoadSecrets = true
deps.Params.configMissingOK = false
deps.Params.baseConfigMissingOK = false
deps.Params.defaultConfPath = ""

w, err := setupConfig(deps)
Expand Down

0 comments on commit b5ffc2f

Please sign in to comment.