Lines
84.62 %
Functions
50 %
Branches
100 %
use server::config::set_system_config;
/// Boot the server the same way the original CLI entrypoint did:
/// install drivers, run migrations, load config. Used by both
/// binaries so the initialization sequence stays identical.
///
/// # Errors
/// Returns an `anyhow::Error` if `database` conflicts with an already resolved
/// database URL, if the boot task fails or is aborted, or if
/// `set_system_config` fails for the optional `setopt` override.
pub async fn start_server(
database: Option<String>,
setopt: Option<(String, String)>,
) -> anyhow::Result<()> {
if let Some(db) = database {
server::db::use_url(db)?;
}
// `server::start` already returns the boot task's handle; spawning it again
// only added a third Result layer to unwrap.
server::start().await.await??;
if let Some((field, content)) = setopt {
set_system_config(&field, content.into()).await?;
Ok(())