Description
openedon Sep 3, 2024
Description
When we set a port configuration like quarkus.http.port
to 0
, we want Quarkus to assign a random port.
The issue is the particular case of quarkus.http.port
, the port generation and assignment are delegated to Vert.x. Why is this an issue?
Because we rely on the Config system to lookup the real quarkus.http.port
, we have to mutate the configuration after the configuration is already loaded. We use SystemProperties
, but this does not guarantee an override because there may be higher ordinal sources in the Config system that references quarkus.http.port
.
Also, we need configuration to be loaded to start Vert.x. Once we load the configuration objects, we cache them for obvious reasons: for performance and to ensure everyone sees the exact copy of the configuration. This becomes another problem when we reference ${quarkus.http.port}
as an expression, which at the time of evaluation will be set to 0
.
We observed some of these issues in:
- System properties config overrides in tests does not seem to take effect properly in quarkus 3.14.1 #42844
- Move REST Client configuration to use @ConfigMapping #42106 (comment)
- Test profile config properties can bleed into other test profiles #27996
- Improve compatibility of the REST Client configuration #42932 (comment)
Implementation ideas
Ideally, we should move all random port assignments before loading the configuration.