1pub mod cmd;
2
3use crate::{
4 chain_config::{check_and_update_chain_config, ChainConfig},
5 util::HumanReadableConfig,
6};
7use forc_tracing::println_green;
8use fuel_core::service::FuelService;
9
10pub async fn run(cmd: cmd::LocalCmd, dry_run: bool) -> anyhow::Result<Option<FuelService>> {
14 check_and_update_chain_config(ChainConfig::Local).await?;
15
16 let config = fuel_core::service::Config::from(cmd);
17
18 if dry_run {
19 println_green(&format!("{}", HumanReadableConfig::from(&config)));
21 return Ok(None);
22 }
23 println_green("Starting fuel-core service...");
24 let service = FuelService::new_node(config)
25 .await
26 .map_err(|e| anyhow::anyhow!("Failed to start fuel-core service: {}", e))?;
27
28 println_green(&format!("Service started on: {}", service.bound_address));
29 Ok(Some(service))
30}