diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18a075e0..3b215373 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,6 +123,8 @@ jobs: -p cdk-payment-processor, --bin cdk-cli, --bin cdk-cli --features sqlcipher, + --bin cdk-cli --features redb, + --bin cdk-cli --features "sqlcipher redb", --bin cdk-mintd, --bin cdk-mintd --features redis, --bin cdk-mintd --features redb, diff --git a/crates/cdk-cli/Cargo.toml b/crates/cdk-cli/Cargo.toml index 24e5bddf..f509ab63 100644 --- a/crates/cdk-cli/Cargo.toml +++ b/crates/cdk-cli/Cargo.toml @@ -11,12 +11,14 @@ rust-version.workspace = true [features] sqlcipher = ["cdk-sqlite/sqlcipher"] +# MSRV is not tracked with redb enabled +redb = ["dep:cdk-redb"] [dependencies] anyhow.workspace = true bip39.workspace = true cdk = { workspace = true, default-features = false, features = ["wallet", "auth"]} -cdk-redb = { workspace = true, features = ["wallet"] } +cdk-redb = { workspace = true, features = ["wallet"], optional = true } cdk-sqlite = { workspace = true, features = ["wallet"] } clap.workspace = true serde.workspace = true diff --git a/crates/cdk-cli/src/main.rs b/crates/cdk-cli/src/main.rs index f89ce145..f7e07daa 100644 --- a/crates/cdk-cli/src/main.rs +++ b/crates/cdk-cli/src/main.rs @@ -9,6 +9,7 @@ use bip39::Mnemonic; use cdk::cdk_database; use cdk::cdk_database::WalletDatabase; use cdk::wallet::{HttpClient, MultiMintWallet, Wallet, WalletBuilder}; +#[cfg(feature = "redb")] use cdk_redb::WalletRedbDatabase; use cdk_sqlite::WalletSqliteDatabase; use clap::{Parser, Subcommand}; @@ -132,9 +133,15 @@ async fn main() -> Result<()> { Arc::new(sql) } "redb" => { - let redb_path = work_dir.join("cdk-cli.redb"); - - Arc::new(WalletRedbDatabase::new(&redb_path)?) + #[cfg(feature = "redb")] + { + let redb_path = work_dir.join("cdk-cli.redb"); + Arc::new(WalletRedbDatabase::new(&redb_path)?) + } + #[cfg(not(feature = "redb"))] + { + bail!("redb feature not enabled"); + } } _ => bail!("Unknown DB engine"), };