()
| 97 | |
| 98 | #[rocket::main] |
| 99 | async fn main() -> Result<()> { |
| 100 | { |
| 101 | use tracing_subscriber::{fmt, EnvFilter}; |
| 102 | let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); |
| 103 | fmt().with_env_filter(filter).with_ansi(false).init(); |
| 104 | } |
| 105 | let args = Args::parse(); |
| 106 | let figment = config::load_config_figment_with_default(DEFAULT_CONFIG, args.config.as_deref()); |
| 107 | let sim_config: SimulatorCoreConfig = figment |
| 108 | .focus("core") |
| 109 | .extract() |
| 110 | .context("Failed to extract simulator core config")?; |
| 111 | warn!( |
| 112 | attestation_file = %sim_config.simulator.attestation_file, |
| 113 | patch_report_data = sim_config.simulator.patch_report_data, |
| 114 | "starting dstack guest-agent simulator" |
| 115 | ); |
| 116 | if sim_config.simulator.patch_report_data { |
| 117 | warn!("simulator will rewrite report_data to match requests; quote verification may fail against the original fixture signature"); |
| 118 | } else { |
| 119 | warn!("simulator will preserve fixture report_data; cert/key binding and requested report_data may not match"); |
| 120 | } |
| 121 | let attestation = |
| 122 | simulator::load_versioned_attestation(&sim_config.simulator.attestation_file)?; |
| 123 | let state = AppState::new_with_platform( |
| 124 | sim_config.core, |
| 125 | Arc::new(SimulatorPlatform::new( |
| 126 | attestation, |
| 127 | sim_config.simulator.patch_report_data, |
| 128 | )), |
| 129 | ) |
| 130 | .await |
| 131 | .context("Failed to create simulator app state")?; |
| 132 | run_server(state, figment, args.watchdog).await |
| 133 | } |
| 134 | |
| 135 | #[cfg(test)] |
| 136 | mod tests { |
nothing calls this directly
no test coverage detected