async fn launch_server(
    app_state: &AppState,
    server_plugin: &DockerComposeServerPlugin,
) -> Result<Box<dyn ServerHandle>> {
    /*
     * Build and launch the server.
     */
    run_docker_compose(server_plugin, &["up", "--detach"]).with_context(|| {
        format!(
            "Running '{} up --detach' failed.",
            server_plugin
                .server_script()
                .file_name()
                .expect("Unable to get control script name.")
                .to_string_lossy()
        )
    })?;

    /*
     * The server containers have now been started, though they're not necessarily ready yet. Build a
     * handle for it, copying any fields from the plugin that will be needed (as we can't safely downcast
     * the plugin, so this is the only way to have access to those fields from the handle).
     */
    let server_plugin = app_state
        .find_server_plugin(server_plugin.server_name().as_str())
        .expect("Unable to find server plugin");
    let http_client = super::client_default()?;
    let server_handle = DockerComposeServerHandle {
        server_plugin: server_plugin.clone(),
        http_client,
    };

    // Wait (up to a timeout) for the server to be ready.
    match wait_for_ready(app_state, &server_handle).await {
        Err(err) => {
            server_handle.emit_logs_info()?;
            Err(err)
        }
        Ok(_) => {
            let server_handle: Box<dyn ServerHandle> = Box::new(server_handle);
            Ok(server_handle)
        }
    }
}
/// Launches the server, producing a boxed [SparkFhirServerHandle].
///
/// Parameters:
/// * `app_state`: the application's [AppState]
/// * `server_plugin`: the [DockerComposeServerPlugin] for the server to launch
Launches the server, producing a boxed [SparkFhirServerHandle].
Launches the server producing a boxed [ SparkFhirServerHandle ] .
async fn launch_server(
    app_state: &AppState,
    server_plugin: &DockerComposeServerPlugin,
) -> Result<Box<dyn ServerHandle>> {
    /*
     * Build and launch the server.
     */
    run_docker_compose(server_plugin, &["up", "--detach"]).with_context(|| {
        format!(
            "Running '{} up --detach' failed.",
            server_plugin
                .server_script()
                .file_name()
                .expect("Unable to get control script name.")
                .to_string_lossy()
        )
    })?;
    /*
     * The server containers have now been started, though they're not necessarily ready yet. Build a
     * handle for it, copying any fields from the plugin that will be needed (as we can't safely downcast
     * the plugin, so this is the only way to have access to those fields from the handle).
     */
    let server_plugin = app_state
        .find_server_plugin(server_plugin.server_name().as_str())
        .expect("Unable to find server plugin");
    let http_client = super::client_default()?;
    let server_handle = DockerComposeServerHandle {
        server_plugin: server_plugin.clone(),
        http_client,
    };
    // Wait (up to a timeout) for the server to be ready.
    match wait_for_ready(app_state, &server_handle).await {
        Err(err) => {
            server_handle.emit_logs_info()?;
            Err(err)
        }
        Ok(_) => {
            let server_handle: Box<dyn ServerHandle> = Box::new(server_handle);
            Ok(server_handle)
        }
    }
}
async fn launch_server ( app_state : & AppState , server_plugin : & DockerComposeServerPlugin , ) -> Result < Box < dyn ServerHandle > > { /*
     * Build and launch the server.
     */ run_docker_compose ( server_plugin , & [ " " , " " ] ) . with_context ( | | { format ! ( " " server_plugin server_script ( ) file_name ( ) expect ( " " ) to_string_lossy ( ) ) } ) ? ; /*
     * The server containers have now been started, though they're not necessarily ready yet. Build a
     * handle for it, copying any fields from the plugin that will be needed (as we can't safely downcast
     * the plugin, so this is the only way to have access to those fields from the handle).
     */ let server_plugin = app_state . find_server_plugin ( server_plugin . server_name ( ) . as_str ( ) ) . expect ( " " ) ; let http_client = super :: client_default ( ) ? ; let server_handle = DockerComposeServerHandle { server_plugin : server_plugin . clone ( ) , http_client , } ; // Wait (up to a timeout) for the server to be ready. match wait_for_ready ( app_state , & server_handle ) . await { Err ( err ) => { server_handle . emit_logs_info ( ) ? ; Err ( err ) } Ok ( _ ) => { let server_handle : Box < dyn ServerHandle > = Box :: new ( server_handle ) ; Ok ( server_handle ) } } }
Launches the server, producing a boxed [SparkFhirServerHandle].
Launches the server producing a boxed [ SparkFhirServerHandle ] .
app_state
&AppState
server_plugin
&DockerComposeServerPlugin
app_state
&AppState
server_plugin
&DockerComposeServerPlugin