mirror of
https://github.com/mikedilger/chorus.git
synced 2026-05-03 06:51:42 +00:00
chorus_init binary (just setup the database and exit)
This commit is contained in:
parent
72c874ff37
commit
e5251e0f57
27
src/bin/chorus_init.rs
Normal file
27
src/bin/chorus_init.rs
Normal 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(())
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user