mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 23:25:22 +01:00
feat: Add support for sqlcipher
This commit is contained in:
@@ -31,6 +31,10 @@ struct Cli {
|
||||
/// Database engine to use (sqlite/redb)
|
||||
#[arg(short, long, default_value = "sqlite")]
|
||||
engine: String,
|
||||
/// Database password for sqlcipher
|
||||
#[cfg(feature = "sqlcipher")]
|
||||
#[arg(long)]
|
||||
password: Option<String>,
|
||||
/// Path to working dir
|
||||
#[arg(short, long)]
|
||||
work_dir: Option<PathBuf>,
|
||||
@@ -106,7 +110,15 @@ async fn main() -> Result<()> {
|
||||
match args.engine.as_str() {
|
||||
"sqlite" => {
|
||||
let sql_path = work_dir.join("cdk-cli.sqlite");
|
||||
#[cfg(not(feature = "sqlcipher"))]
|
||||
let sql = WalletSqliteDatabase::new(&sql_path).await?;
|
||||
#[cfg(feature = "sqlcipher")]
|
||||
let sql = {
|
||||
match args.password {
|
||||
Some(pass) => WalletSqliteDatabase::new(&sql_path, pass).await?,
|
||||
None => bail!("Missing database password"),
|
||||
}
|
||||
};
|
||||
|
||||
sql.migrate().await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user