()
| 37 | |
| 38 | impl Router { |
| 39 | pub fn new() -> Result<Self, RouterError> { |
| 40 | let client = reqwest::Client::builder() |
| 41 | .connect_timeout(Duration::from_secs(30)) |
| 42 | .build() |
| 43 | .map_err(|e| RouterError::Internal(format!("failed to build HTTP client: {e}")))?; |
| 44 | Ok(Self { |
| 45 | routes: Vec::new(), |
| 46 | client, |
| 47 | }) |
| 48 | } |
| 49 | |
| 50 | pub fn from_config(config: &RouterConfig) -> Result<Self, RouterError> { |
| 51 | let resolved = config.resolve_routes()?; |