-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.rs
More file actions
42 lines (30 loc) · 940 Bytes
/
main.rs
File metadata and controls
42 lines (30 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use std::path::PathBuf;
use clap::Parser;
use service::{Server, State, endpoint::Role};
pub type Result<T, E = color_eyre::eyre::Error> = std::result::Result<T, E>;
pub type Config = service::Config;
use self::build::build;
use self::upload::upload;
mod build;
mod stream;
mod upload;
#[tokio::main]
async fn main() -> Result<()> {
let Args { config, root } = Args::parse();
let config = Config::load(config.unwrap_or_else(|| root.join("config.toml"))).await?;
service::tracing::init(&config.tracing, &config.description)?;
let state = State::load(root).await?;
Server::new(Role::Builder, &config, &state)
.with_task("stream", stream::run(state.clone()))
.start()
.await?;
service::tracing::shutdown().await;
Ok(())
}
#[derive(Debug, Parser)]
struct Args {
#[arg(long, short)]
config: Option<PathBuf>,
#[arg(long, short, default_value = ".")]
root: PathBuf,
}