Skip to content

Commit

Permalink
Fix certificate check option naming (#1546)
Browse files Browse the repository at this point in the history
This fixes an inconsistency between the `ignore_certs` configuration
option and the `--no-check-certificate` CLI flag by changing the CLI
flag to be `--ignore-certs` with an alias for the old version.

Closes #480.
  • Loading branch information
cd-work authored Dec 2, 2024
1 parent fb87125 commit db1e22c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ pub fn app() -> Command {
.long("timeout")
.value_name("TIMEOUT")
.help("Set the timeout (in seconds) for requests to the Phylum api"),
Arg::new("no-check-certificate")
Arg::new("ignore-certs")
.action(ArgAction::SetTrue)
.long("no-check-certificate")
.long("ignore-certs")
.alias("no-check-certificate")
.help("Don't validate the server certificate when performing api requests"),
Arg::new("org")
.short('o')
Expand Down
2 changes: 1 addition & 1 deletion cli/src/bin/phylum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn handle_commands() -> CommandResult {

let mut config = config::load_config(&matches)?;

config.set_ignore_certs_cli(matches.get_flag("no-check-certificate"));
config.set_ignore_certs_cli(matches.get_flag("ignore-certs"));
if config.ignore_certs() {
log::warn!("Ignoring TLS server certificate verification per user request.");
}
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Config {
self.ignore_certs_cli || self.ignore_certs
}

/// Set the CLI `--no-check-certificate` override value.
/// Set the CLI `--ignore-certs` override value.
pub fn set_ignore_certs_cli(&mut self, ignore_certs_cli: bool) {
self.ignore_certs_cli = ignore_certs_cli;
}
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl<'a> TestExtension<'a> {
}

#[cfg(feature = "extensions")]
impl<'a> Drop for TestExtension<'a> {
impl Drop for TestExtension<'_> {
fn drop(&mut self) {
self.test_cli.run(["extension", "uninstall", "test-ext"]).success();
fs::remove_dir_all(&self.extension_path).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/phylum.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Usage: phylum [OPTIONS] [COMMAND]
`-t`, `--timeout` `<TIMEOUT>`
&emsp; Set the timeout (in seconds) for requests to the Phylum api

`--no-check-certificate`
`--ignore-certs`
&emsp; Don't validate the server certificate when performing api requests

`-o`, `--org` `<ORG>`
Expand Down

0 comments on commit db1e22c

Please sign in to comment.