influxdata / influxdata/influx-cli
config vs. env var precedence in influx CLI can be confusing
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 75
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
__Steps to reproduce:__
Using nightly build of Windows CLI.
1. create config profile using influx to connect to local influxdb instance using all access token
2. attempt to execute any command via influx such as influx bucket list or influx v1 auth create -- results in unauthorized
3. however, using all the same params (org, token, url) without the config profile, these commands work just fine.
Example:
```
C:\Program Files\InfluxData\influxdb2-new>influx bucket list --host http://localhost:8086 -o thall-org -t 9HrCnWDsD0Adhq...rest_of_the_all_access_token=
ID Name Retention Shard group duration Organization ID
782886daf164bae1 _monitoring 168h0m0s 24h0m0s 5ecbfa70b25f4cc9
5ecbfa70b25f4cc9 _tasks 72h0m0s 24h0m0s 5ecbfa70b25f4cc9
760dc052f12e7c80 oss_metrics 168h0m0s 24h0m0s 5ecbfa70b25f4cc9
a084ffba216305be telegraf 2160h0m0s 24h0m0s 5ecbfa70b25f4cc9
C:\Program Files\InfluxData\influxdb2-new>influx config list
Active Name URL Org
* local http://localhost:8086 thall-org
C:\Program Files\InfluxData\influxdb2-new>influx config set -n local -t 9HrCnWDsD0Adhq...rest_of_the_all_access_token=
Active Name URL Org
* local http://localhost:8086 thall-org
C:\Program Files\InfluxData\influxdb2-new>influx bucket list
Error: Failed to retrieve buckets: unauthorized access.
See 'influx bucket list -h' for help
```
__Expected behavior:__
Config profiles should work if configured correctly.
__Actual behavior:__
Unauthorized, despite using params that appear to work otherwise
__Environment info:__
* System info: Windows
* InfluxDB version: nightly (April 15th)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Windows behavior with `influx config set` and `influx bucket list`, comparing the configured profile with equivalent `--host`, `-o`, and `-t` flags. Trace how the CLI resolves config and environment or command-line values; done means correctly configured profiles authenticate for commands such as `bucket list` and `v1 auth create`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100