Skip to content

Commit

Permalink
fix deploy command
Browse files Browse the repository at this point in the history
  • Loading branch information
NanezX committed Nov 7, 2023
1 parent 92a3094 commit f7030aa
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions subgraph/cli/deploy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,36 @@ pub fn deploy_subgraph(config: DeployArgs) -> anyhow::Result<()> {
return Err(anyhow!("Failed to create subgraph endpoint node"));
}

// Deploy Subgraph to the endpoint
let is_deploy = run_cmd(
"bash",
&[
"-c",
&format!(
"npx graph deploy --node {} --ipfs http://localhost:5001 {} --version-label 1",
end_point, subgraph_name
),
],
);
if !is_deploy {
return Err(anyhow!("Failed to deploy subgraph"));
if config.url.host_str() == Some("localhost") {
// Deploy Subgraph to the endpoint local
let is_deploy = run_cmd(
"bash",
&[
"-c",
&format!(
"npx graph deploy --node {} --ipfs http://localhost:5001 {} --version-label 1",
end_point, subgraph_name
),
],
);
if !is_deploy {
return Err(anyhow!("Failed to deploy subgraph"));
}
} else {
// Deploy Subgraph to the endpoint
let is_deploy = run_cmd(
"bash",
&[
"-c",
&format!(
"npx graph deploy --node {} {} --version-label 1",
end_point, subgraph_name
),
],
);
if !is_deploy {
return Err(anyhow!("Failed to deploy subgraph"));
}
}

Ok(())
Expand Down

0 comments on commit f7030aa

Please sign in to comment.