chorus_init binary (just setup the database and exit)

This commit is contained in:
Mike Dilger 2025-03-28 09:40:11 +13:00
parent 72c874ff37
commit e5251e0f57
No known key found for this signature in database
GPG Key ID: 47581A78D4329BA4

27
src/bin/chorus_init.rs Normal file
View File

@ -0,0 +1,27 @@
use chorus::error::Error;
use chorus::globals::GLOBALS;
use std::env;
#[tokio::main]
async fn main() -> Result<(), Error> {
// Get args (config path)
let mut args = env::args();
if args.len() <= 1 {
panic!("USAGE: chorus <config_path>");
}
let _ = args.next(); // ignore program name
let config_path = args.next().unwrap();
let config = chorus::load_config(&config_path)?;
chorus::setup_logging(&config);
// Log host name
log::info!(target: "Server", "HOSTNAME = {}", config.hostname);
chorus::setup_store(&config)?;
let _ = GLOBALS.store.get().unwrap().sync();
Ok(())
}