sensu / sensu-influxdb-handler

Sensu Go InfluxDB Metrics Handler
https://sensu.io
MIT License
14 stars 16 forks source link

use envvars as default value for sensitive argments. #21

Closed jspaleta closed 5 years ago

jspaleta commented 5 years ago

Treat influx addr, username and password as sensitive credentials.

It's preferable to read sensitive information from envvars. commandline arguments can be read from the process table for ex: ps -aux

Solution in this PR:

  1. Use os.Getenv() to retrieve default values from env vars when constructing command flags.
  2. Do not mark these as required flags, if not set and env var defaults are used.
  3. Manual test for empty string values and error out accordingly.
jspaleta commented 5 years ago

requested changes made. I have locally built version running now using envvars

sensuctl handler info influxdb-particle
=== influxdb-particle
Name:                  influxdb-particle
Type:                  pipe
Timeout:               30
Filters:               
Mutator:               
Execute:               RUN:  /usr/local/bin/sensu-influxdb-handler -d 'particle'
Environment Variables: INFLUXDB_ADDR=http://localhost:8086, INFLUXDB_USER=nunya, INFLUXDB_PASS=business