Multiple services over multiple sockets example creates an incorrect AppConfig
- Lenguaje dominante
- Rust
- Estrellas
- 24.8k
- Forks
- 1.9k
- Merge medio
- 23 h 10 min
- PR fusionados (30 d)
- 26
Descripción
Per conversations on the discord, the most idiomatic way to spawn multiple services over multiple sockets is by following the current [actix-http example](https://github.com/actix/actix-web/blob/03456b8/actix-http/examples/actix-web.rs) using `actix_server::Server`.
This is preferred over the alternative of spawning more than one `HttpServer` as that results in each `HttpServer` spawning exclusive threads for themselves (e.g. 2 of them would spawn n*2 threads, where n is number of physical cores).
## Expected Behavior
## Current Behavior
However the example requires construction of an `AppConfig` whose only public constructor is its `Default`, which results in an incorrect configuration (server's hostname, address, and whether TLS is in use). This results in incorrect values for `HttRequest`'s `app_config`, `connection_info` and maybe `url_for` methods and even possibly other things?
## Possible Solution
Per @robjtede it's probable that this is a gap in the public interface. Either `AppConfig` needs an alternative constructor or possibly `actix_server::Server` or its builder could construct `AppConfig` from the values they have.
## Steps to Reproduce (for bugs)
## Context
## Your Environment
- Actix Web Version: 4.2
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.