MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / main

Function main

verifier/src/main.rs:161–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159
160#[rocket::main]
161async fn main() -> Result<()> {
162 {
163 use tracing_subscriber::{fmt, EnvFilter};
164 let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
165 fmt().with_env_filter(filter).with_ansi(false).init();
166 }
167
168 let cli = Cli::parse();
169
170 let default_config_str = include_str!("../dstack-verifier.toml");
171
172 let figment = Figment::from(rocket::Config::default())
173 .merge(Toml::string(default_config_str))
174 .merge(Toml::file(&cli.config))
175 .merge(Env::prefixed("DSTACK_VERIFIER_"));
176
177 let config: Config = figment.extract().context("Failed to load configuration")?;
178
179 // Check for oneshot mode
180 if let Some(file_path) = cli.verify {
181 if let Err(e) = run_oneshot(&file_path, &config).await {
182 error!("Oneshot verification failed: {:#}", e);
183 std::process::exit(1);
184 }
185 std::process::exit(0);
186 }
187
188 let verifier = Arc::new(CvmVerifier::new(
189 config.image_cache_dir.clone(),
190 config.image_download_url.clone(),
191 std::time::Duration::from_secs(config.image_download_timeout_secs),
192 config.pccs_url.clone(),
193 ));
194
195 rocket::custom(figment)
196 .mount("/", rocket::routes![verify_cvm, health])
197 .manage(verifier)
198 .attach(AdHoc::on_liftoff("Startup", |_| {
199 Box::pin(async {
200 info!("dstack-verifier started successfully");
201 })
202 }))
203 .launch()
204 .await
205 .map_err(|err| anyhow::anyhow!("launch rocket failed: {err:?}"))?;
206 Ok(())
207}

Callers

nothing calls this directly

Calls 3

fileClass · 0.85
run_oneshotFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected