| 167 | } |
| 168 | |
| 169 | fn build_runtime_state( |
| 170 | config: &Watch, |
| 171 | manifest_path: &Path, |
| 172 | binary_packages: HashSet<String>, |
| 173 | ) -> Result<RuntimeState> { |
| 174 | let ip = IpAddr::from_str(&config.invoke_address) |
| 175 | .into_diagnostic() |
| 176 | .wrap_err("invalid invoke address")?; |
| 177 | let (runtime_port, proxy_addr) = if config.tls_options.is_secure() { |
| 178 | ( |
| 179 | config.invoke_port + 1, |
| 180 | Some(SocketAddr::from((ip, config.invoke_port))), |
| 181 | ) |
| 182 | } else { |
| 183 | (config.invoke_port, None) |
| 184 | }; |
| 185 | let runtime_addr = SocketAddr::from((ip, runtime_port)); |
| 186 | |
| 187 | Ok(RuntimeState::new( |
| 188 | runtime_addr, |
| 189 | proxy_addr, |
| 190 | manifest_path.to_path_buf(), |
| 191 | config.only_lambda_apis, |
| 192 | binary_packages, |
| 193 | config.router.clone(), |
| 194 | config.concurrency, |
| 195 | )) |
| 196 | } |
| 197 | |
| 198 | async fn start_server( |
| 199 | subsys: SubsystemHandle, |