[web] Respect config settings where possible
This commit is contained in:
parent
6e1afdb4b6
commit
37c0390678
|
@ -171,17 +171,20 @@ async fn main() -> std::io::Result<()> {
|
|||
}
|
||||
};
|
||||
log::info!("Starting with configuration {:?}", config);
|
||||
start_server().await
|
||||
start_server(config).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn start_server() -> std::io::Result<()> {
|
||||
println!("Starting pronouns-today-web on 127.0.0.1:8080");
|
||||
HttpServer::new(|| {
|
||||
async fn start_server(config: configuration::Conf) -> std::io::Result<()> {
|
||||
// Where we binding bois
|
||||
let bind = format!("0.0.0.0:{}", config.port);
|
||||
|
||||
println!("Starting pronouns-today-web on {}", &bind);
|
||||
HttpServer::new(move|| {
|
||||
let logger = Logger::default();
|
||||
let app = App::new()
|
||||
.data(InstanceSettings::default())
|
||||
.data(config.instance_settings.clone())
|
||||
.wrap(logger)
|
||||
.wrap(middleware::NormalizePath::new(TrailingSlash::Trim))
|
||||
.service(create_link);
|
||||
|
@ -201,7 +204,7 @@ async fn start_server() -> std::io::Result<()> {
|
|||
.service(resource("/{name}/{prefs}").to(handle_basic_request))
|
||||
.default_service(web::to(not_found))
|
||||
})
|
||||
.bind("0.0.0.0:8080")?
|
||||
.bind(&bind)?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue