mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 23:25:22 +01:00
feat: Add optional redb feature flag for database support
This commit is contained in:
committed by
thesimplekid
parent
9b87a65940
commit
7a9faec984
@@ -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"),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user