mirror of
https://codeberg.org/icewind/wifi-prometheus-exporter.git
synced 2026-06-03 08:34:25 +02:00
customizable port
This commit is contained in:
parent
0620d39a1d
commit
6de75d2190
1 changed files with 3 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ use std::path::Path;
|
|||
use warp::Filter;
|
||||
use std::ffi::OsStr;
|
||||
use std::sync::Arc;
|
||||
use std::str::FromStr;
|
||||
|
||||
struct WifiLister {
|
||||
session: Session
|
||||
|
|
@ -42,6 +43,7 @@ async fn main() -> Result<(), MainError> {
|
|||
let mut env: HashMap<String, String> = dotenv::vars().collect();
|
||||
let addr = env.remove("ADDR").ok_or("No ADDR set")?;
|
||||
let keyfile = env.remove("KEYFILE").ok_or("No KEYFILE set")?;
|
||||
let port = env.get("PORT").and_then(|s| u16::from_str(s).ok()).unwrap_or(80);
|
||||
|
||||
let wifi_listener = Arc::new(WifiLister::new(addr, &keyfile)?);
|
||||
|
||||
|
|
@ -54,7 +56,7 @@ async fn main() -> Result<(), MainError> {
|
|||
});
|
||||
|
||||
warp::serve(metrics)
|
||||
.run(([127, 0, 0, 1], 3030u16))
|
||||
.run(([0, 0, 0, 0], port))
|
||||
.await;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue