Skip to content

Commit

Permalink
--url option added to forc deploy (FuelLabs#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp authored May 20, 2022
1 parent 82ad97a commit e9d084f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions forc/src/cli/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ pub struct Command {
/// needs to be updated, Forc will exit with an error
#[clap(long)]
pub locked: bool,
/// The node url to deploy, if not specified uses DEFAULT_NODE_URL.
/// If url is specified overrides network url in manifest file (if there is one).
#[clap(long, short)]
pub url: Option<String>,
}

pub(crate) async fn exec(command: Command) -> Result<()> {
Expand Down
6 changes: 6 additions & 0 deletions forc/src/ops/forc_deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub async fn deploy(command: DeployCommand) -> Result<fuel_tx::ContractId> {
output_directory,
minify_json_abi,
locked,
url,
} = command;

let build_command = BuildCommand {
Expand Down Expand Up @@ -63,6 +64,11 @@ pub async fn deploy(command: DeployCommand) -> Result<fuel_tx::ContractId> {
_ => DEFAULT_NODE_URL,
};

let node_url = match url {
Some(url_str) => url_str,
None => node_url.to_string(),
};

let client = FuelClient::new(node_url)?;

match client.submit(&tx).await {
Expand Down

0 comments on commit e9d084f

Please sign in to comment.