Compare commits
No commits in common. "c3c5ff4ebe0243886007c2b26e211f355eaa9b8e" and "31a54b7389fac9d08cc4760179f72b52725246ee" have entirely different histories.
c3c5ff4ebe
...
31a54b7389
11
README.md
11
README.md
@ -1,11 +0,0 @@
|
||||
# berlinerbaeder-exporter
|
||||
|
||||
Prometheus exporter for occupancy of open air pools operated by the city of Berlin.
|
||||
|
||||
There is also a Map: <https://www.berlinerbaeder.de/baeder/sommerbaeder-auslastung/>
|
||||
|
||||
## Run
|
||||
|
||||
```
|
||||
berlinerbaeder-exporter --listen "[::]:1234"
|
||||
```
|
26
src/main.rs
26
src/main.rs
@ -29,35 +29,11 @@ struct TrafficDataItem {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
||||
let mut args = std::env::args();
|
||||
let _name = args.next().unwrap();
|
||||
|
||||
let mut listen = String::from("[::]:3000");
|
||||
|
||||
loop {
|
||||
let arg = if let Some(arg) = args.next() {
|
||||
arg
|
||||
} else {
|
||||
break;
|
||||
};
|
||||
|
||||
match arg.as_str() {
|
||||
"--listen" => {
|
||||
listen = args.next().unwrap();
|
||||
}
|
||||
unknown => {
|
||||
println!("unknown option: {}", unknown);
|
||||
std::process::exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let app = Router::new()
|
||||
.route("/", get(route_index))
|
||||
.route("/metrics", get(route_metrics));
|
||||
|
||||
let listener = tokio::net::TcpListener::bind(listen).await.unwrap();
|
||||
let listener = tokio::net::TcpListener::bind("[::]:3000").await.unwrap();
|
||||
println!("Server listening on: http://{}", listener.local_addr().unwrap());
|
||||
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user