rebterlai/cmd/logcatcher/src/main.rs

46 lines
1.1 KiB
Rust

#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate prometheus;
#[macro_use]
extern crate tracing;
use anyhow::Result;
use std::net::{IpAddr, SocketAddr};
use structopt::StructOpt;
mod server;
use server::*;
#[derive(Debug, StructOpt)]
#[structopt(name = "logcatcher", about = "The log catcher service")]
pub(crate) struct Config {
/// The TCP host to listen on for HTTP traffic.
#[structopt(short, long, default_value = "127.0.0.1:3848")]
pub(crate) http_host: SocketAddr,
/// The TCP host to serve debug traffic from.
#[structopt(short, long, default_value = "127.0.0.1:45012")]
pub(crate) debug_host: SocketAddr,
/// The IP address/es to expect proxied requests from.
#[structopt(short, long)]
pub(crate) proxy_ips: Option<Vec<IpAddr>>,
// /// The place to store logs to disk.
// #[structopt(short, long, default_value = "./var/log")]
// pub(crate) log_dir: PathBuf,
}
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let cfg = Config::from_args();
println!("{:?}", cfg);
let server = Server::new(cfg)?;
server.run().await?;
Ok(())
}