Skip to content

Commit

Permalink
printer: expose config struct properties (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke authored Jul 31, 2024
1 parent 6cecc73 commit 8f2a45d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/collector/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ var printerStatusMap = map[uint16]string{
}

type Config struct {
printerInclude string `yaml:"printer_include"`
printerExclude string `yaml:"printer_exclude"`
Include string `yaml:"printer_include"`
Exclude string `yaml:"printer_exclude"`
}

var ConfigDefaults = Config{
printerInclude: ".+",
printerExclude: "",
Include: ".+",
Exclude: "",
}

type collector struct {
Expand All @@ -63,8 +63,8 @@ func New(logger log.Logger, config *Config) types.Collector {
config = &ConfigDefaults
}
c := &collector{
printerInclude: &config.printerInclude,
printerExclude: &config.printerExclude,
printerInclude: &config.Include,
printerExclude: &config.Exclude,
}
c.SetLogger(logger)
return c
Expand All @@ -75,11 +75,11 @@ func NewWithFlags(app *kingpin.Application) types.Collector {
printerInclude: app.Flag(
FlagPrinterInclude,
"Regular expression to match printers to collect metrics for",
).Default(ConfigDefaults.printerInclude).String(),
).Default(ConfigDefaults.Include).String(),
printerExclude: app.Flag(
FlagPrinterExclude,
"Regular expression to match printers to exclude",
).Default(ConfigDefaults.printerExclude).String(),
).Default(ConfigDefaults.Exclude).String(),
}
return c
}
Expand Down

0 comments on commit 8f2a45d

Please sign in to comment.