Mola-maker opened a new pull request, #4478:
URL: https://github.com/apache/iggy/pull/4478

   ## Why
   
   The CLI already reads `IGGY_USERNAME` and `IGGY_PASSWORD` from the 
environment in `credentials.rs`, but a personal access token could only be 
passed with `--token` (or a config file), so scripts and CI jobs had to put the 
token on the command line, where it shows up in process lists and shell 
history. #4463 asks for the missing env var.
   
   ## What
   
   - `core/cli/src/credentials.rs`: a non-empty `IGGY_TOKEN` resolves to 
`Credentials::PersonalAccessToken`. Precedence: command line flags first, then 
`IGGY_TOKEN`, then the `IGGY_USERNAME`/`IGGY_PASSWORD` pair. The token is 
intentionally not wired through a clap `env` attribute: the credential options 
live in mutually exclusive clap groups, and a clap env fallback errors out when 
combined with `-u`/`-p` flags.
   - `core/cli/src/args/mod.rs`: `--help` for `--username`, `--password` and 
`--token` now names the matching environment variable and states the precedence.
   - Tests: `should_resolve_iggy_token_with_documented_precedence` in 
`core/integration/tests/cli/user/test_login_options.rs` covers a valid token 
from the env var alone, a `--token` flag overriding an invalid env token, a 
valid env token winning over a wrong env password, and an invalid env token 
failing even with valid env username/password. The help snapshot in 
`test_help_command.rs` is updated for the new `--help` text.
   
   ## Verification
   
   - `cargo fmt --all -- --check` clean
   - `cargo clippy -p iggy-cli --all-features --all-targets -- -D warnings` 
clean
   - `cargo test -p iggy-cli` 87 passed
   - `cargo test -p integration -- cli::general::test_help_command` passed 
(runs the built CLI binary)
   - The login-options integration tests need a host where iggy-server can use 
io_uring; the sandbox used for local development blocks io_uring with seccomp 
(the pre-existing `should_be_successful` cannot start a server there either), 
so that suite is left to CI here.
   
   One note for maintainers: `prek` is not installed in my environment, so I 
could not run it locally; the checks above follow the order in AGENTS.md. Happy 
to address anything it flags in CI.
   
   Closes #4463


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to