allow PORT env var, cargo update

This commit is contained in:
41666 2023-08-23 14:47:12 -04:00
parent 6b9c879ba7
commit d22a0762ab
3 changed files with 334 additions and 373 deletions

670
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,27 +0,0 @@
job "agg-population" {
type = "service"
update {
max_parallel = 1
stagger = "10s"
}
group "api" {
count = 1
network {
port "http" {
static = 3000
}
}
task "api" {
driver = "docker"
config {
image = "ghcr.io/genudine/agg-population/agg-population:latest"
ports = ["http"]
}
}
}
}

View file

@ -49,8 +49,14 @@ async fn main() {
}
});
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
tracing::debug!("listening on {}", addr);
let addr = SocketAddr::from((
[0, 0, 0, 0],
std::env::var("PORT")
.unwrap_or("3000".to_string())
.parse()
.unwrap(),
));
tracing::debug!("listening on http://{}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await