Skip to content

Commit

Permalink
refactor: Move flags.go to pkg/option
Browse files Browse the repository at this point in the history
Logically flags.go belongs to pkg/option, so let's just move it there. I
also had to move ParseMetricsLabelFilter to pkg/option to break a cyclic
dependency.

Signed-off-by: Michi Mutsuzaki <[email protected]>
  • Loading branch information
michi-covalent committed Oct 12, 2023
1 parent 8ddace9 commit f21ca72
Show file tree
Hide file tree
Showing 6 changed files with 569 additions and 575 deletions.
8 changes: 4 additions & 4 deletions cmd/tetragon/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ func readConfigSettings(defaultConfDir string, defaultConfDropIn string, dropIns
option.ReadConfigDir(defaultConfDropIn)

// Read now the passed key --config-dir
if viper.IsSet(keyConfigDir) {
configDir := viper.GetString(keyConfigDir)
if viper.IsSet(option.KeyConfigDir) {
configDir := viper.GetString(option.KeyConfigDir)
// viper.IsSet could return true on an empty string reset
if configDir != "" {
err := option.ReadConfigDir(configDir)
if err != nil {
log.WithField(keyConfigDir, configDir).WithError(err).Fatal("Failed to read config from directory")
log.WithField(option.KeyConfigDir, configDir).WithError(err).Fatal("Failed to read config from directory")
} else {
log.WithField(keyConfigDir, configDir).Info("Loaded config from directory")
log.WithField(option.KeyConfigDir, configDir).Info("Loaded config from directory")
}
}
}
Expand Down
Loading

0 comments on commit f21ca72

Please sign in to comment.