Change peach-web to use custom go-sbot key path #115

Closed
notplants wants to merge 3 commits from keypaths into go-sbot-service
2 changed files with 5 additions and 2 deletions

View File

@ -39,6 +39,7 @@ chrono = "0.4"
dirs = "4.0"
env_logger = "0.8"
futures = "0.3"
#golgi = { git = "https://git.coopcloud.tech/golgi-ssb/golgi.git", branch = "dev" }
golgi = { git = "https://git.coopcloud.tech/golgi-ssb/golgi.git" }
lazy_static = "1.4"
log = "0.4"

View File

@ -11,6 +11,7 @@ use std::{
use async_std::task;
use dirs;
use futures::stream::TryStreamExt;
use golgi::sbot::Keystore;
use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot};
use log::debug;
use peach_lib::config_manager::get_config_value;
@ -67,13 +68,14 @@ pub async fn init_sbot_with_config(
) -> Result<Sbot, PeachWebError> {
debug!("Initialising an sbot client with configuration parameters");
// initialise sbot connection with ip:port and shscap from config file
let key_path = format!("{}/secret", get_config_value("GO_SBOT_DATADIR")?);
let sbot_client = match sbot_config {
// TODO: panics if we pass `Some(conf.shscap)` as second arg
Some(conf) => {
let ip_port = conf.lis.clone();
Sbot::init(Some(ip_port), None).await?
Sbot::init(Keystore::CustomGoSbot(key_path), Some(ip_port), None).await?
}
None => Sbot::init(None, None).await?,
None => Sbot::init(Keystore::CustomGoSbot(key_path), None, None).await?,
};
Ok(sbot_client)