Skip to content

Commit

Permalink
minor improvements on cloud.rs (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhuo Zhang <[email protected]>
  • Loading branch information
0xmountaintop and lispc authored Oct 17, 2024
1 parent f1a3ec0 commit d713457
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions examples/cloud.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_trait::async_trait;
use clap::Parser;
use reqwest::Url;

use scroll_proving_sdk::{
config::{CloudProverConfig, Config},
Expand All @@ -22,7 +23,7 @@ struct Args {
}

struct CloudProver {
base_url: String,
base_url: Url,
api_key: String,
}

Expand All @@ -44,8 +45,9 @@ impl ProvingService for CloudProver {

impl CloudProver {
pub fn new(cfg: CloudProverConfig) -> Self {
let base_url = Url::parse(&cfg.base_url).expect("cannot parse cloud prover base_url");
Self {
base_url: cfg.base_url,
base_url,
api_key: cfg.api_key,
}
}
Expand All @@ -57,7 +59,12 @@ async fn main() -> anyhow::Result<()> {

let args = Args::parse();
let cfg: Config = Config::from_file(args.config_file)?;
let cloud_prover = CloudProver::new(cfg.prover.cloud.clone().unwrap());
let cloud_prover = CloudProver::new(
cfg.prover
.cloud
.clone()
.ok_or_else(|| anyhow::anyhow!("Missing cloud prover configuration"))?,
);
let prover = ProverBuilder::new(cfg)
.with_proving_service(Box::new(cloud_prover))
.build()
Expand Down

0 comments on commit d713457

Please sign in to comment.