Skip to content

Commit

Permalink
resolve conflicts with elastic-agent repo
Browse files Browse the repository at this point in the history
  • Loading branch information
leehinman committed Jun 27, 2024
1 parent e89e53b commit fff6331
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions libbeat/cfgfile/cfgfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ var (
// The default config cannot include the beat name as it is not initialized
// when this variable is created. See ChangeDefaultCfgfileFlag which should
// be called prior to flags.Parse().
configfiles = config.StringArrFlag(nil, "c", "beat.yml", "Configuration file, relative to path.config")
configfiles = config.StringArrFlag(nil, "beatconfig", "beat.yml", "Configuration file, relative to path.config")
overwrites = config.SettingFlag(nil, "E", "Configuration overwrite")

// Additional default settings, that must be available for variable expansion
defaults = config.MustNewConfigFrom(map[string]interface{}{
"path": map[string]interface{}{
"home": ".", // to be initialized by beat
"config": "${path.home}",
"data": fmt.Sprint("${path.home}", string(os.PathSeparator), "data"),
"logs": fmt.Sprint("${path.home}", string(os.PathSeparator), "logs"),
"config": "${beatpath.home}",
"data": fmt.Sprint("${beatpath.home}", string(os.PathSeparator), "data"),
"logs": fmt.Sprint("${beatpath.home}", string(os.PathSeparator), "logs"),
},
})

Expand All @@ -57,10 +57,10 @@ func init() {
return config.ConfigOverwriteFlag(nil, overwrites, name, name, "", usage)
}

homePath = makePathFlag("path.home", "Home path")
configPath = makePathFlag("path.config", "Configuration path")
makePathFlag("path.data", "Data path")
makePathFlag("path.logs", "Logs path")
homePath = makePathFlag("beatpath.home", "Home path")
configPath = makePathFlag("beatpath.config", "Configuration path")
makePathFlag("beatpath.data", "Data path")
makePathFlag("beatpath.logs", "Logs path")
}

// OverrideChecker checks if a config should be overwritten.
Expand Down Expand Up @@ -108,7 +108,7 @@ func HandleFlags() error {
home = *homePath
}

_ = defaults.SetString("path.home", -1, home)
_ = defaults.SetString("beatpath.home", -1, home)

if len(overwrites.GetFields()) > 0 {
common.PrintConfigDebugf(overwrites, "CLI setting overwrites (-E flag):")
Expand Down
8 changes: 4 additions & 4 deletions libbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ func GenRootCmdWithSettings(beatCreator beat.Creator, settings instance.Settings
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("v"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("e"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("environment"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("path.config"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("path.data"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("path.logs"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("path.home"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("beatpath.config"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("beatpath.data"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("beatpath.logs"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("beatpath.home"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("strict.perms"))
if f := flag.CommandLine.Lookup("plugin"); f != nil {
rootCmd.PersistentFlags().AddGoFlag(f)
Expand Down

0 comments on commit fff6331

Please sign in to comment.