Skip to content

Commit

Permalink
Fix init method to remove config
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongHunP authored and junha1 committed May 30, 2023
1 parent 4487b8a commit 3e4b293
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ async fn run(
) -> eyre::Result<()> {
match args.command {
Commands::Genesis => Client::genesis(&path).await,
Commands::Init => Client::init(&path, config).await,
Commands::Init => Client::init(&path).await,
Commands::Clone { url } => {
RawRepository::clone(&path, &url).await?;
std::env::set_current_dir(path.clone())?;
Client::init(&path, config).await
Client::init(&path).await
}
Commands::Network => todo!("network is not implemented yet"),
Commands::Chat { .. } => todo!("chat is not implemented yet"),
Expand Down
6 changes: 3 additions & 3 deletions simperby/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ impl Client {
Ok(())
}

pub async fn init(path: &str, config: types::Config) -> Result<()> {
storage::init(path, config).await?;
pub async fn init(path: &str) -> Result<()> {
storage::init(path).await?;
Ok(())
}

Expand Down Expand Up @@ -123,7 +123,7 @@ impl Client {
let auth = this.auth.clone();
drop(this);
storage::clear(&path).await?;
storage::init(&path, config.clone()).await?;
storage::init(&path).await?;
self.inner = Some(Self::open(&path, config, auth).await?.inner.unwrap());
return Ok(report);
}
Expand Down
2 changes: 1 addition & 1 deletion simperby/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn consensus_state_path(path: &str) -> String {
format!("{path}/.simperby/consensus/state")
}

pub(crate) async fn init(path: &str, _config: types::Config) -> Result<()> {
pub(crate) async fn init(path: &str) -> Result<()> {
let mut repository = DistributedRepository::new(
Arc::new(RwLock::new(RawRepository::open(path).await?)),
simperby_repository::Config {
Expand Down
4 changes: 1 addition & 3 deletions simperby/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ async fn normal_1() {
let server_dir = create_temp_dir();
setup_pre_genesis_repository(&server_dir, fi.reserved_state.clone()).await;
Client::genesis(&server_dir).await.unwrap();
Client::init(&server_dir, Config { peers: Vec::new() })
.await
.unwrap();
Client::init(&server_dir).await.unwrap();
// Add push configs to server repository.
run_command(format!(
"cd {server_dir} && git config receive.advertisePushOptions true"
Expand Down

0 comments on commit 3e4b293

Please sign in to comment.