up icon indicating copy to clipboard operation
up copied to clipboard

Prefer command-line options over environmental variables

Open plumbis opened this issue 3 years ago • 0 comments

What problem are you facing?

If the environmental variable UP_USER or UP_TOKEN are set they are preferred over command-line arguments.

vagrant@kubecontroller-01:~$ export UP_TOKEN=my_token

vagrant@kubecontroller-01:~$ up login -u my_username -p my_password
Usage: up login

Login to Upbound.

Flags:
  -h, --help                               Show context-sensitive help.
  -v, --version                            Print version and exit.

  -u, --username=STRING                    Username used to execute command ($UP_USER).
  -p, --password=STRING                    Password for specified user. '-' to read from stdin ($UP_PASSWORD).
  -t, --token=STRING                       Token used to execute command. '-' to read from stdin ($UP_TOKEN).
      --endpoint=https://api.upbound.io    Endpoint used for Upbound API ($UP_ENDPOINT).
      --profile=STRING                     Profile used to execute command ($UP_PROFILE).
  -a, --account=STRING                     Account used to execute command ($UP_ACCOUNT).

up: error: --username and --token can't be used together

This is also true for a set username.

vagrant@kubecontroller-01:~$ export UP_USER=my_username

vagrant@kubecontroller-01:~$ up login --token=my_token
Usage: up login

Login to Upbound.

Flags:
  -h, --help                               Show context-sensitive help.
  -v, --version                            Print version and exit.

  -u, --username=STRING                    Username used to execute command ($UP_USER).
  -p, --password=STRING                    Password for specified user. '-' to read from stdin ($UP_PASSWORD).
  -t, --token=STRING                       Token used to execute command. '-' to read from stdin ($UP_TOKEN).
      --endpoint=https://api.upbound.io    Endpoint used for Upbound API ($UP_ENDPOINT).
      --profile=STRING                     Profile used to execute command ($UP_PROFILE).
  -a, --account=STRING                     Account used to execute command ($UP_ACCOUNT).

up: error: --username and --token can't be used together

This is fine if you've recently set them like this example but is hard to diagnose if you are unaware of the variables.

How could Upbound help solve your problem?

If the user or token command-line arguments are passed then the environmental variable should be ignored.

plumbis avatar Jun 08 '22 19:06 plumbis