chore(examples): make html-examples port configurable via env
req: examples/001
This commit is contained in:
@@ -230,7 +230,11 @@ async fn main() {
|
|||||||
.route("/app.css", get(css))
|
.route("/app.css", get(css))
|
||||||
.with_state(state);
|
.with_state(state);
|
||||||
|
|
||||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3029));
|
let port = std::env::var("HEMX_HTML_EXAMPLES_PORT")
|
||||||
|
.unwrap_or_else(|_| "3029".to_string())
|
||||||
|
.parse::<u16>()
|
||||||
|
.expect("HEMX_HTML_EXAMPLES_PORT must be a valid u16");
|
||||||
|
let addr = SocketAddr::from(([127, 0, 0, 1], port));
|
||||||
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
||||||
println!("hemx HTML examples: http://{addr}");
|
println!("hemx HTML examples: http://{addr}");
|
||||||
axum::serve(listener, app).await.unwrap();
|
axum::serve(listener, app).await.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user