Skip to content

Commit 74882b8

Browse files
committed
cli: make fetching optional
1 parent 72765b6 commit 74882b8

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ jobs:
7070
run: cargo test -p revoke-test -p rustls-upki -p upki
7171
- name: Without features
7272
run: cargo check --locked -p upki --no-default-features
73+
- name: CLI without features
74+
run: cargo check --locked -p upki-cli --no-default-features
75+
- name: CLI with native-tls
76+
run: cargo check --locked -p upki-cli --no-default-features --features fetch-native-tls
7377

7478
- name: Build FFI
7579
run: cargo cbuild --locked -p upki

upki-cli/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ license.workspace = true
88
readme = "README.md"
99
description = "Platform-independent browser-grade certificate infrastructure"
1010

11+
[features]
12+
default = ["fetch"]
13+
fetch = ["upki/fetch", "__fetch"]
14+
fetch-native-tls = ["upki/fetch-native-tls", "__fetch"]
15+
__fetch = ["upki/__fetch"]
16+
1117
[dependencies]
1218
clap.workspace = true
1319
eyre.workspace = true
1420
rustls-pki-types.workspace = true
15-
upki = { version = "=1.0.0-beta.2", path = "../upki", features = ["fetch"] }
21+
upki = { version = "=1.0.0-beta.2", path = "../upki" }
1622
tokio.workspace = true
1723
toml.workspace = true
1824
tracing.workspace = true

upki-cli/src/bin/upki.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use tracing::level_filters::LevelFilter;
1212
use tracing_subscriber::EnvFilter;
1313
use tracing_subscriber::layer::SubscriberExt;
1414
use tracing_subscriber::util::SubscriberInitExt;
15-
use upki::revocation::{Index, Manifest, RevocationCheckInput, fetch};
15+
use upki::revocation::{Index, RevocationCheckInput};
16+
#[cfg(feature = "__fetch")]
17+
use upki::revocation::{Manifest, fetch};
1618
use upki::{Config, ConfigPath};
1719

1820
#[tokio::main(flavor = "current_thread")]
@@ -44,7 +46,9 @@ async fn main() -> Result<ExitCode, Report> {
4446
let config = Config::from_file_or_user_default(&config_path)?;
4547

4648
Ok(match args.command {
49+
#[cfg(feature = "fetch")]
4750
Command::Fetch { dry_run } => fetch(dry_run, &config).await?,
51+
#[cfg(feature = "fetch")]
4852
Command::Verify => Manifest::from_config(&config)?.verify(&config)?,
4953
Command::ShowConfigPath => unreachable!(),
5054
Command::ShowConfig => {
@@ -93,6 +97,7 @@ enum Command {
9397
/// If the `revocation.cache_dir` path does not exist, this tool creates it and parent directories.
9498
///
9599
/// This also deletes filters that become unreferenced.
100+
#[cfg(feature = "__fetch")]
96101
Fetch {
97102
/// Download the new manifest, and then describe what actions are needed to
98103
/// synchronize with the remote server.
@@ -107,6 +112,7 @@ enum Command {
107112
/// Exits non-zero if the manifest if any filter file is missing or corrupt.
108113
///
109114
/// This command does no network I/O. It does not say anything whether the files are up-to-date or recent.
115+
#[cfg(feature = "__fetch")]
110116
Verify,
111117

112118
/// Checks the revocation status of a certificate.

0 commit comments

Comments
 (0)