Skip to content

Commit

Permalink
feat(service): add PORT env var
Browse files Browse the repository at this point in the history
  • Loading branch information
bigslycat committed Jan 16, 2024
1 parent fab5fde commit e1ce1b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ mod user;
#[rocket::launch]
fn rocket() -> _ {
let bot_token = var("BOT_TOKEN").expect("Environment variable `BOT_TOKEN` is not defined.");
let port = var("PORT").ok().and_then(|x| x.parse::<u16>().ok()).unwrap_or(80);

let env = Env { bot_token };

let mut build = rocket::build()
.configure(rocket::Config {
port: 80,
port,
address: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
..rocket::Config::default()
})
Expand Down

0 comments on commit e1ce1b8

Please sign in to comment.