Skip to content

Commit a58f944

Browse files
authored
Merge pull request AnalogJ#619 from datenzar/override-config-with-env-variables
feat: Ability to override commands args
2 parents 1ec4783 + 3de12cd commit a58f944

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

collector/pkg/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ func (c *configuration) Init() error {
4949
c.SetDefault("commands.metrics_smart_args", "--xall --json")
5050
c.SetDefault("commands.metrics_smartctl_wait", 0)
5151

52+
//configure env variable parsing.
53+
c.SetEnvPrefix("COLLECTOR")
54+
c.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
55+
c.AutomaticEnv()
56+
5257
//c.SetDefault("collect.short.command", "-a -o on -S on")
5358

5459
c.SetDefault("allow_listed_devices", []string{})

0 commit comments

Comments
 (0)