Created
May 20, 2020 19:13
-
-
Save svenstaro/e8d3bf5891a8ed6744c8fc9e897ea466 to your computer and use it in GitHub Desktop.
geht einfach
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::net::{SocketAddr, AddrParseError}; | |
use anyhow::{Context, Result}; | |
use structopt::StructOpt; | |
use http::uri::{PathAndQuery, InvalidUri}; | |
use simplelog::{LevelFilter, TermLogger}; | |
#[derive(StructOpt, Clone, Debug)] | |
#[structopt( | |
name = "site24x7_exporter", | |
author, | |
about, | |
global_settings = &[structopt::clap::AppSettings::ColoredHelp], | |
)] | |
pub struct Config { | |
/// Address on which to expose metrics and web interface | |
#[structopt( | |
long = "web.listen-address", | |
default_value = "0.0.0.0:9803", | |
)] | |
pub listen_address: SocketAddr, | |
/// Path under which to expose metrics | |
#[structopt( | |
long = "web.telemetry-path", | |
default_value = "/metrics", | |
)] | |
pub metrics_path: PathAndQuery, | |
/// Only log messages with the given severity or above | |
#[structopt( | |
long = "log.level", | |
default_value = "info", | |
)] | |
pub loglevel: LevelFilter, | |
} | |
fn main() -> Result<()> { | |
let args = Config::from_args(); | |
TermLogger::new(args.loglevel, simplelog::Config::default(), simplelog::TerminalMode::Mixed); | |
dbg!(args); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment