Closed iohzrd closed 2 years ago
I was able to solve my issue by setting the IPFS_PATH environment variable as follows:
pub async fn launch_ipfs_daemon(client: &IpfsClient) -> Result<String, String> {
println!("Starting IPFS.");
env::set_var(
"IPFS_PATH",
config::identia_app_data_path()
.into_os_string()
.to_str()
.unwrap(),
);
Command::new_sidecar("ipfs")
.or(Err(String::from("Can't find ipfs binary")))?
.args(&[
"daemon",
"-c",
config::identia_app_data_path()
.into_os_string()
.to_str()
.unwrap(),
"--migrate=true",
])
.spawn()
.map_err(|err| format!("Failed to execute ipfs: {:?}", err))?;
match wait_for_ipfs_ready(&client).await {
Ok(ready) => println!("ipfs ready: {:?}", ready),
Err(e) => eprintln!("error waiting for ipfs: {}", e),
}
match get_ipfs_id(&client).await {
Ok(id) => Ok(id),
Err(e) => Err(e),
}
}
That being said, it would still be nice to be able to pass the path directly from ipfs to fs-repo-migrations. I'm gonna leave this issue open for now, until I get a response. In the mean time, I may add a note about the env variable to the documentation for those who may encounter a similar issue in the future.
Using IPFS_PATH is the way to switch repos, -c
is only for switching config, so I don't think there's anything to do here.
I use go-ipfs in my project https://github.com/iohzrd/identia. I try to keep IPFS (along with all my dependencies) up-to-date but, i'm having trouble doing so as there isn't a clear way to migrate from v0.11 to v0.12 without manual intervention...
What I've tried so far:
Keep in mind that the migration needs to be done programmatically and not but the user. And, my app does not depend on electron or any node runtime, so using the JS ipfs-repo-migrations package is not an option.