diff options
Diffstat (limited to 'crates/turtle/src/command/client/store')
| -rw-r--r-- | crates/turtle/src/command/client/store/pull.rs | 9 | ||||
| -rw-r--r-- | crates/turtle/src/command/client/store/push.rs | 11 | ||||
| -rw-r--r-- | crates/turtle/src/command/client/store/rebuild.rs | 6 | ||||
| -rw-r--r-- | crates/turtle/src/command/client/store/rekey.rs | 12 |
4 files changed, 20 insertions, 18 deletions
diff --git a/crates/turtle/src/command/client/store/pull.rs b/crates/turtle/src/command/client/store/pull.rs index 6b709a64..f2e628d6 100644 --- a/crates/turtle/src/command/client/store/pull.rs +++ b/crates/turtle/src/command/client/store/pull.rs @@ -2,12 +2,7 @@ use clap::Args; use eyre::Result; use crate::atuin_client::{ - database::Database, - encryption::load_key, - record::store::Store, - record::sync::Operation, - record::{sqlite_store::SqliteStore, sync}, - settings::Settings, + database::ClientSqlite, encryption::load_key, record::{sqlite_store::SqliteStore, store::Store, sync::{self, Operation}}, settings::Settings }; #[derive(Args, Debug)] @@ -32,7 +27,7 @@ impl Pull { &self, settings: &Settings, store: SqliteStore, - db: &dyn Database, + db: &ClientSqlite, ) -> Result<()> { if self.force { println!("Forcing local overwrite!"); diff --git a/crates/turtle/src/command/client/store/push.rs b/crates/turtle/src/command/client/store/push.rs index 30177dbd..beec613c 100644 --- a/crates/turtle/src/command/client/store/push.rs +++ b/crates/turtle/src/command/client/store/push.rs @@ -1,6 +1,6 @@ use crate::atuin_common::record::HostId; use clap::Args; -use eyre::Result; +use eyre::{OptionExt, Result}; use uuid::Uuid; use crate::atuin_client::{ @@ -42,11 +42,12 @@ impl Push { println!("Clearing remote store"); let client = Client::new( - &settings.sync_address, - settings.sync_auth().await?.into_auth_token()?, + &settings.sync.address, settings.network_connect_timeout, - settings.network_timeout * 10, // we may be deleting a lot of data... so up the - // timeout + // we may be deleting a lot of data... so increase the + // timeout + settings.network_timeout * 10, + settings.sync.user_id()?.ok_or_eyre("no sync user-id")?, ) .expect("failed to create client"); diff --git a/crates/turtle/src/command/client/store/rebuild.rs b/crates/turtle/src/command/client/store/rebuild.rs index 0959b74e..bee1aa05 100644 --- a/crates/turtle/src/command/client/store/rebuild.rs +++ b/crates/turtle/src/command/client/store/rebuild.rs @@ -5,7 +5,7 @@ use eyre::{Result, bail}; use crate::command::client::daemon as daemon_cmd; use crate::atuin_client::{ - database::Database, encryption, history::store::HistoryStore, + database::ClientSqlite, encryption, history::store::HistoryStore, record::sqlite_store::SqliteStore, settings::Settings, }; @@ -19,7 +19,7 @@ impl Rebuild { &self, settings: &Settings, store: SqliteStore, - database: &dyn Database, + database: &ClientSqlite, ) -> Result<()> { // keep it as a string and not an enum atm // would be super cool to build this dynamically in the future @@ -41,7 +41,7 @@ impl Rebuild { &self, settings: &Settings, store: SqliteStore, - database: &dyn Database, + database: &ClientSqlite, ) -> Result<()> { let encryption_key: [u8; 32] = encryption::load_key(settings)?.into(); diff --git a/crates/turtle/src/command/client/store/rekey.rs b/crates/turtle/src/command/client/store/rekey.rs index 3472222f..b99fb16a 100644 --- a/crates/turtle/src/command/client/store/rekey.rs +++ b/crates/turtle/src/command/client/store/rekey.rs @@ -32,9 +32,15 @@ impl Rekey { store.re_encrypt(¤t_key, &new_key).await?; - println!("Store rewritten. Saving new key"); - let mut file = File::create(settings.key_path.clone()).await?; - file.write_all(key.as_bytes()).await?; + if let Some(key_path) = settings.sync.encryption_key_path.as_ref() { + println!("Store rewritten. Saving new key"); + let mut file = File::create(key_path).await?; + file.write_all(key.as_bytes()).await?; + } else { + println!( + "No key-path (settings.sync.encryption_key_path) set in config, will not save new key." + ); + } Ok(()) } |
