aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-05-15 16:25:13 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-05-15 16:25:13 +0200
commit519b9904d892f9e3e54920377c58f62fefbb7383 (patch)
treea87d63ffd9a56b15b5f24779195fdf6b3fad75e3
parentc434c45380fc6926a5525f97cc4df98a9b3cda94 (diff)
downloadmacroblog.rs-519b9904d892f9e3e54920377c58f62fefbb7383.tar.gz
macroblog.rs-519b9904d892f9e3e54920377c58f62fefbb7383.tar.bz2
macroblog.rs-519b9904d892f9e3e54920377c58f62fefbb7383.zip
fix: Make actix follow PORT envvar
The server needs to follow `POST` envvar for heroku's sake.
-rw-r--r--src/bin/actix.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/actix.rs b/src/bin/actix.rs
index dd03ece..c2f81fe 100644
--- a/src/bin/actix.rs
+++ b/src/bin/actix.rs
@@ -23,12 +23,13 @@ async fn posts(name: web::Path<String>) -> impl Responder {
#[actix_web::main]
async fn main() -> std::io::Result<()> {
+ let port = env::var("PORT").unwrap_or("3000".into()).parse::<u16>().unwrap_or(3000);
HttpServer::new(|| {
App::new()
.service(index)
.service(posts)
})
- .bind(("0.0.0.0", 3000))?
+ .bind(("0.0.0.0", port))?
.run()
.await
}