aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 92f51a7..49815b8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,5 @@
use std::convert::Infallible;
-use std::{include_str};
+use std::{include_str, env};
use std::net::SocketAddr;
use hyper::{Body, Request, Response, Server};
use hyper::service::{make_service_fn, service_fn};
@@ -93,7 +93,8 @@ async fn request(req: Request<Body>) -> Result<Response<Body>, Infallible> {
#[tokio::main]
async fn main() {
- let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
+ let port = env::var("PORT").unwrap_or("3000".into()).parse::<u16>().unwrap_or(300);
+ let addr = SocketAddr::from(([127, 0, 0, 1], port));
let make_svc = make_service_fn(|_conn| async {
Ok::<_, Infallible>(service_fn(request))