@@ -17,7 +17,10 @@ use crate::certgen;
1717use crate :: compute:: driver_config:: GuestTlsPaths ;
1818use crate :: config_file:: { self , ConfigFile , GatewayFileSection } ;
1919use crate :: defaults:: { self , LocalTlsPaths } ;
20- use crate :: { ServerStartupConfig , run_server, tracing_bus:: TracingLogBus } ;
20+ use crate :: {
21+ ComputeDriverRegistry , ServerStartupConfig , install_default_compute_drivers, run_server,
22+ tracing_bus:: TracingLogBus ,
23+ } ;
2124
2225/// `OpenShell` gateway process - gRPC and HTTP server with protocol multiplexing.
2326///
@@ -220,6 +223,11 @@ pub fn command() -> Command {
220223}
221224
222225pub async fn run_cli ( ) -> Result < ( ) > {
226+ run_cli_with_compute_drivers ( install_default_compute_drivers ( ) ) . await
227+ }
228+
229+ /// Run the gateway CLI with the compute drivers linked by the binary.
230+ pub async fn run_cli_with_compute_drivers ( compute_drivers : ComputeDriverRegistry ) -> Result < ( ) > {
223231 rustls:: crypto:: ring:: default_provider ( )
224232 . install_default ( )
225233 . map_err ( |e| miette:: miette!( "failed to install rustls crypto provider: {e:?}" ) ) ?;
@@ -229,7 +237,7 @@ pub async fn run_cli() -> Result<()> {
229237
230238 match cli. command {
231239 Some ( Commands :: GenerateCerts ( args) ) => certgen:: run ( args) . await ,
232- None => Box :: pin ( run_from_args ( cli. run , matches) ) . await ,
240+ None => Box :: pin ( run_from_args ( cli. run , matches, compute_drivers ) ) . await ,
233241 }
234242}
235243
@@ -469,7 +477,11 @@ fn prepare_server_config(args: &mut RunArgs, matches: &ArgMatches) -> Result<Ser
469477 } )
470478}
471479
472- async fn run_from_args ( mut args : RunArgs , matches : ArgMatches ) -> Result < ( ) > {
480+ async fn run_from_args (
481+ mut args : RunArgs ,
482+ matches : ArgMatches ,
483+ compute_drivers : ComputeDriverRegistry ,
484+ ) -> Result < ( ) > {
473485 let prepared = prepare_server_config ( & mut args, & matches) ?;
474486
475487 let tracing_log_bus = TracingLogBus :: new ( ) ;
@@ -538,7 +550,7 @@ async fn run_from_args(mut args: RunArgs, matches: ArgMatches) -> Result<()> {
538550
539551 info ! ( bind = %prepared. config. bind_address, "Starting OpenShell server" ) ;
540552
541- let result = Box :: pin ( run_server ( prepared, tracing_log_bus) ) . await ;
553+ let result = Box :: pin ( run_server ( prepared, tracing_log_bus, compute_drivers ) ) . await ;
542554
543555 tracing_handle. shutdown ( ) ;
544556
0 commit comments