27 lines
732 B
Rust
27 lines
732 B
Rust
use sage::Identity;
|
|
use sheepd_core::{
|
|
args::{SheepdArgs, SheepdCommand},
|
|
config::AgentConfig,
|
|
};
|
|
mod api;
|
|
mod sheepd_core;
|
|
use rumqttc::AsyncClient;
|
|
use tokio::sync::OnceCell;
|
|
|
|
pub static MQTT: OnceCell<AsyncClient> = OnceCell::const_new();
|
|
pub static IDENTITY: OnceCell<Identity> = OnceCell::const_new();
|
|
pub static AGENT: OnceCell<AgentConfig> = OnceCell::const_new();
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
tracing_subscriber::fmt::init();
|
|
let args: SheepdArgs = argh::from_env();
|
|
|
|
if let Some(command) = args.command {
|
|
match command {
|
|
SheepdCommand::Join(join_command) => sheepd_core::cmd::join(join_command),
|
|
}
|
|
} else {
|
|
sheepd_core::daemon::start_daemon().await;
|
|
}
|
|
}
|