Make web server address configurable
This commit is contained in:
parent
3a4a4c1cfa
commit
8b53a22b78
3 changed files with 20 additions and 10 deletions
|
|
@ -28,9 +28,9 @@ async fn recurring_task(state: &Server) {
|
|||
.await;
|
||||
}
|
||||
|
||||
pub async fn run(state: Server) {
|
||||
pub async fn run(server: Server) {
|
||||
loop {
|
||||
recurring_task(&state).await;
|
||||
tokio::time::sleep(state.config.repo_update_delay).await;
|
||||
recurring_task(&server).await;
|
||||
tokio::time::sleep(server.config.repo_update_delay).await;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ impl Base {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn run(state: Server) -> somehow::Result<()> {
|
||||
pub async fn run(server: Server) -> somehow::Result<()> {
|
||||
// TODO Add text body to body-less status codes
|
||||
|
||||
let app = Router::new()
|
||||
|
|
@ -50,9 +50,9 @@ pub async fn run(state: Server) -> somehow::Result<()> {
|
|||
.route("/queue/table", get(queue::get_table))
|
||||
.route("/queue/:id", get(queue_id::get))
|
||||
.fallback(get(r#static::static_handler))
|
||||
.with_state(state.clone());
|
||||
.with_state(server.clone());
|
||||
|
||||
axum::Server::bind(&"0.0.0.0:8000".parse().unwrap())
|
||||
axum::Server::bind(&server.config.web_address)
|
||||
.serve(app.into_make_service())
|
||||
.await?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue