Skip to content

Commit

Permalink
Add check that clap arguments are valid (#1090)
Browse files Browse the repository at this point in the history
* Add check that clap arguments are valid

* Fix arguments
  • Loading branch information
Jake-Shadle authored Feb 3, 2025
1 parent 258eae8 commit 4e59eac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ jobs:
- name: Build
run: cargo build -p qt -p quilkin -p quilkin-xds --tests
- run: cargo nextest run --no-tests=pass -p qt -p quilkin -p quilkin-xds quilkin
- name: Validate Quilkin's clap arguments
run: |
set +e # don't fail on error, we expect the command to fail since we aren't providing arguments
cargo run -p quilkin
if [ $? -ne 255 ]; then
echo "::error ::clap arguments seem to have an error"
exit 1
fi
exit 0
build:
name: Build
Expand Down
12 changes: 6 additions & 6 deletions src/cli/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,30 @@ pub struct Service {
#[clap(
long = "service.tls.cert",
env = "QUILKIN_SERVICE_TLS_CERT",
requires("service.tls.key")
requires("tls_key")
)]
tls_cert: Option<Vec<u8>>,
/// The private key for the cert
#[clap(
long = "service.tls.key",
env = "QUILKIN_SERVICE_TLS_KEY",
requires("service.tls.cert")
requires("tls_cert")
)]
tls_key: Option<Vec<u8>>,
/// Path to a PEM encoded certificate, if supplied, applies to the mds and xds service(s)
#[clap(
long = "service.tls.cert-path",
env = "QUILKIN_SERVICE_TLS_CERT_PATH",
requires("service.tls.key-path"),
conflicts_with("service.tls.cert")
requires("tls_key_path"),
conflicts_with("tls_cert")
)]
tls_cert_path: Option<std::path::PathBuf>,
/// Path to the private key for the cert
#[clap(
long = "service.tls.key-path",
env = "QUILKIN_SERVICE_TLS_KEY_PATH",
requires("service.tls.cert-path"),
conflicts_with("service.tls.key")
requires("tls_cert_path"),
conflicts_with("tls_key")
)]
tls_key_path: Option<std::path::PathBuf>,
}
Expand Down

0 comments on commit 4e59eac

Please sign in to comment.