-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
DB3 Core uses the rust clap crate to generate cli commands and arguments. We consistently also set an env var that can be used in place of an explicit cli argument. This useful for arguments that don't often change (a TOKEN) as well for gitops deployments to set up containers which can then inject config via env vars.
Clap automatically generates cli help text from the arg/command configuration (via derive macros or builders). The help will display the current value of an env variable for a cli flag or argument.
I propose we do not want to display the token INFLUXDB3_AUTH_TOKEN value when displaying the cli help.
The token can be long, disrupting the formatting/display of the help and it seems an unnecessary way to print out the token. If the token is set via an env var and an invalid token there will be an error do I don't think much is lost for debugging by not showing that a token is set.
I'd prefer clap have a <redacted> option but that isn't available -- only HideEnvValues via hide_env_values=true.
for example compare this output
$ influxdb3 show system -h
Display system table data
Usage: influxdb3 show system [OPTIONS] --database <DATABASE_NAME> <COMMAND>
Commands:
table-list List available system tables for the connected host
table Retrieve entries from a specific system table
summary Summarize various types of system table data
Options:
-H, --host <HOST_URL> The host URL of the running InfluxDB 3 Core server [env: INFLUXDB3_HOST_URL=] [default: http://127.0.0.1:8181]
-d, --database <DATABASE_NAME> The name of the database to operate on [env: INFLUXDB3_DATABASE_NAME=]
--token <AUTH_TOKEN> The token for authentication with the InfluxDB 3 Core server [env: INFLUXDB3_AUTH_TOKEN=apiv3_XHMuVh0ON_68z2YAAmvJ3nlDU0AoQCrRhyQk3Iw120YA4tW0ZKin16COU3eET3tg8wDKky4vnHpz-c8T65942A]
-h, --help Print help information
--help-all Print more detailed help information
to
$ influxdb3 show system -h
Display system table data
Usage: influxdb3 show system [OPTIONS] --database <DATABASE_NAME> <COMMAND>
Commands:
table-list List available system tables for the connected host
table Retrieve entries from a specific system table
summary Summarize various types of system table data
Options:
-H, --host <HOST_URL> The host URL of the running InfluxDB 3 Core server [env: INFLUXDB3_HOST_URL=] [default: http://127.0.0.1:8181]
-d, --database <DATABASE_NAME> The name of the database to operate on [env: INFLUXDB3_DATABASE_NAME=]
--token <AUTH_TOKEN> The token for authentication with the InfluxDB 3 Core server [env: INFLUXDB3_AUTH_TOKEN]
-h, --help Print help information
--help-all Print more detailed help information