(state: AppState, figment: Figment)
| 133 | } |
| 134 | |
| 135 | async fn run_external(state: AppState, figment: Figment) -> Result<()> { |
| 136 | let rocket = rocket::custom(figment) |
| 137 | .mount("/", http_routes::external_routes(state.config())) |
| 138 | .mount( |
| 139 | "/prpc", |
| 140 | ra_rpc::prpc_routes!(AppState, ExternalRpcHandler, trim: "Worker."), |
| 141 | ) |
| 142 | .attach(AdHoc::on_response("Add app version header", |_req, res| { |
| 143 | Box::pin(async move { |
| 144 | res.set_raw_header("X-App-Version", app_version()); |
| 145 | }) |
| 146 | })) |
| 147 | .manage(state); |
| 148 | let _ = rocket |
| 149 | .launch() |
| 150 | .await |
| 151 | .map_err(|err| anyhow!("Failed to ignite rocket: {err}"))?; |
| 152 | Ok(()) |
| 153 | } |
| 154 | |
| 155 | async fn run_guest_api(state: AppState, figment: Figment) -> Result<()> { |
| 156 | let rocket = rocket::custom(figment) |
nothing calls this directly
no test coverage detected