(mut args: RunArgs, matches: ArgMatches)
| 426 | } |
| 427 | |
| 428 | async fn run_from_args(mut args: RunArgs, matches: ArgMatches) -> Result<()> { |
| 429 | let prepared = prepare_server_config(&mut args, &matches)?; |
| 430 | |
| 431 | let tracing_log_bus = TracingLogBus::new(); |
| 432 | tracing_log_bus.install_subscriber( |
| 433 | EnvFilter::try_from_default_env() |
| 434 | .unwrap_or_else(|_| EnvFilter::new(&prepared.config.log_level)), |
| 435 | ); |
| 436 | |
| 437 | let has_client_ca = prepared |
| 438 | .config |
| 439 | .tls |
| 440 | .as_ref() |
| 441 | .and_then(|tls| tls.client_ca_path.as_ref()) |
| 442 | .is_some(); |
| 443 | let has_oidc = prepared.config.oidc.is_some(); |
| 444 | |
| 445 | if prepared.config.tls.is_none() { |
| 446 | warn!("TLS disabled — listening on plaintext HTTP"); |
| 447 | } else { |
| 448 | info!("TLS enabled — listening on encrypted HTTPS"); |
| 449 | } |
| 450 | |
| 451 | if has_client_ca { |
| 452 | info!("TLS client certificate verification enabled"); |
| 453 | } |
| 454 | if prepared.config.mtls_auth.enabled { |
| 455 | info!("mTLS user authentication enabled"); |
| 456 | } |
| 457 | if has_oidc { |
| 458 | info!("OIDC authentication enabled"); |
| 459 | } |
| 460 | if prepared.config.auth.allow_unauthenticated_users { |
| 461 | warn!( |
| 462 | "Unauthenticated user access enabled — only use this for trusted local development or a fully trusted fronting proxy" |
| 463 | ); |
| 464 | } |
| 465 | |
| 466 | if !prepared.config.auth.allow_unauthenticated_users |
| 467 | && !prepared.config.mtls_auth.enabled |
| 468 | && !has_oidc |
| 469 | && prepared.config.gateway_jwt.is_none() |
| 470 | { |
| 471 | warn!( |
| 472 | "Neither mTLS user auth nor OIDC nor sandbox JWT auth is configured — \ |
| 473 | the gateway has no authentication mechanism" |
| 474 | ); |
| 475 | } |
| 476 | |
| 477 | info!(bind = %prepared.config.bind_address, "Starting OpenShell server"); |
| 478 | |
| 479 | Box::pin(run_server(prepared, tracing_log_bus)) |
| 480 | .await |
| 481 | .into_diagnostic() |
| 482 | } |
| 483 | |
| 484 | fn parse_compute_driver(value: &str) -> std::result::Result<String, String> { |
| 485 | openshell_core::config::normalize_compute_driver_name(value) |
no test coverage detected