surrealpatch/src/cli/isready.rs
Finn Bear cdf97fcb96
Upgrade to clap v4 (#2015)
Co-authored-by: Steve Fan <29133953+stevefan1999-personal@users.noreply.github.com>
2023-05-22 20:19:35 +01:00

25 lines
597 B
Rust

use crate::cli::abstraction::DatabaseConnectionArguments;
use crate::err::Error;
use clap::Args;
use surrealdb::engine::any::connect;
#[derive(Args, Debug)]
pub struct IsReadyCommandArguments {
#[command(flatten)]
conn: DatabaseConnectionArguments,
}
pub async fn init(
IsReadyCommandArguments {
conn: DatabaseConnectionArguments {
endpoint,
},
}: IsReadyCommandArguments,
) -> Result<(), Error> {
// Initialize opentelemetry and logging
crate::o11y::builder().with_log_level("error").init();
// Connect to the database engine
connect(endpoint).await?;
println!("OK");
Ok(())
}