influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
63 stars 24 forks source link

environment variable $INFLUX_ORG_ID inappropriately overrides command line option #371

Closed rogpeppe closed 2 years ago

rogpeppe commented 2 years ago

As a general convention, command-line options should override environment variables because environment variables are non-specific, whereas command-line options apply only to that single command invocation.

This does not appear to be the case with the influx command.

Here's an example:

$ export INFLUX_ORG_ID=844910ece80be8bc
$ influx write -b devbucket -o 9c5955fc99a60b8f --host https://rog.remocal.influxdev.co/ < /tmp/x.lp
Error: failed to write data: 404 Not Found: organization not found
$ unset INFLUX_ORG_ID
$ influx write -b devbucket -o 9c5955fc99a60b8f --host https://rog.remocal.influxdev.co/ < /tmp/x.lp
$