Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename configMissingOK field to baseConfigMissingOK #14855

Closed
Show file tree
Hide file tree
Changes from all commits
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
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 @@ -24,7 +24,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 @@ -109,7 +109,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