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

feat: Ability to override commands args #619

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

datenzar
Copy link

In order to override the arguments which are used e.g. to call smartctl, they need to be bind to the respective environment variable.

In order to override the arguments which are used e.g. to call smartctl, they need to be bind to the respective environment variable.
@datenzar
Copy link
Author

Hopefully this will fix #221

Comment on lines +51 to +60
// Bind environment variables with COLLECTOR_ prefix
c.BindEnv("host.id", "COLLECTOR_HOST_ID")
c.BindEnv("log.level", "COLLECTOR_LOG_LEVEL")
c.BindEnv("log.file", "COLLECTOR_LOG_FILE")
c.BindEnv("api.endpoint", "COLLECTOR_API_ENDPOINT")
c.BindEnv("commands.metrics_smartctl_bin", "COLLECTOR_COMMANDS_METRICS_SMARTCTL_BIN")
c.BindEnv("commands.metrics_scan_args", "COLLECTOR_COMMANDS_METRICS_SCAN_ARGS")
c.BindEnv("commands.metrics_info_args", "COLLECTOR_COMMANDS_METRICS_INFO_ARGS")
c.BindEnv("commands.metrics_smart_args", "COLLECTOR_COMMANDS_METRICS_SMART_ARGS")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Bind environment variables with COLLECTOR_ prefix
c.BindEnv("host.id", "COLLECTOR_HOST_ID")
c.BindEnv("log.level", "COLLECTOR_LOG_LEVEL")
c.BindEnv("log.file", "COLLECTOR_LOG_FILE")
c.BindEnv("api.endpoint", "COLLECTOR_API_ENDPOINT")
c.BindEnv("commands.metrics_smartctl_bin", "COLLECTOR_COMMANDS_METRICS_SMARTCTL_BIN")
c.BindEnv("commands.metrics_scan_args", "COLLECTOR_COMMANDS_METRICS_SCAN_ARGS")
c.BindEnv("commands.metrics_info_args", "COLLECTOR_COMMANDS_METRICS_INFO_ARGS")
c.BindEnv("commands.metrics_smart_args", "COLLECTOR_COMMANDS_METRICS_SMART_ARGS")
// Bind environment variables with COLLECTOR_ prefix
c.SetEnvPrefix("COLLECTOR")

I think that should work instead. Can you test and confirm @datenzar ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants