Comments (21)
The quotes are required when the map key contains a .
. or else it is handled as a segment separator. In that case, the dotted format does not need quotes, because there is no .
in map key. For Env Vars, the quotes are always required to help us disambiguate the cases since we cannot determine if a _
is a .
or a -
.
from quarkus.
/cc @aureamunoz (stork), @cescoffier (stork)
from quarkus.
cc @radcortez
from quarkus.
Is this a new issue, or has it worked in the past?
from quarkus.
I don't know exactly when it stopped working, but it has always worked. The example I put together is a simple example to illustrate the problem. I actually noticed it in the superheroes sample when trying to run the docker compose files.
from quarkus.
We had a similar report on reactive messaging. I suspect it is related.
from quarkus.
if you clone https://github.com/quarkusio/quarkus-super-heroes, cd quarkus-super-heroes
, and run docker compose -f rest-fights/deploy/docker-compose/java17.yml up
you'll see similar errors:
rest-fights-java17 | Configuration validation failed:
rest-fights-java17 | java.util.NoSuchElementException: SRCFG00014: The config property quarkus.stork.villain.service-discovery.type is required but it could not be found in any config source
rest-fights-java17 | java.util.NoSuchElementException: SRCFG00014: The config property quarkus.stork.narration.service-discovery.type is required but it could not be found in any config source
rest-fights-java17 | java.util.NoSuchElementException: SRCFG00014: The config property quarkus.stork.hero.service-discovery.type is required but it could not be found in any config source
rest-fights-java17 | java.lang.RuntimeException: Failed to start quarkus
The compose file (https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/deploy/docker-compose/java17.yml) looks like this:
rest-fights-java17:
image: quay.io/quarkus-super-heroes/rest-fights:java17-latest
container_name: rest-fights-java17
depends_on:
- fights-db
- apicurio
- fights-kafka
ports:
- "8082:8082"
environment:
QUARKUS_MONGODB_HOSTS: fights-db:27017
KAFKA_BOOTSTRAP_SERVERS: PLAINTEXT://fights-kafka:9092
QUARKUS_LIQUIBASE_MONGODB_MIGRATE_AT_START: "false"
QUARKUS_MONGODB_CREDENTIALS_USERNAME: superfight
QUARKUS_MONGODB_CREDENTIALS_PASSWORD: superfight
QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083
QUARKUS_STORK_VILLAIN_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084
QUARKUS_STORK_NARRATION_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087
QUARKUS_GRPC_CLIENTS_LOCATIONS_HOST: grpc-locations
QUARKUS_GRPC_CLIENTS_LOCATIONS_PORT: 8089
MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL: http://apicurio:8086/apis/registry/v2
QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317
restart: on-failure
networks:
default:
aliases:
- rest-fights
deploy:
resources:
limits:
memory: 1G
cpus: '1'
reservations:
memory: 256M
cpus: '0.5'
from quarkus.
I can verify it works with Quarkus 3.8, so it broke sometime between 3.8 & current.
from quarkus.
If you clone https://github.com/quarkusio/quarkus-super-heroes/tree/3.8.Final (3.8.Final
branch)
and then do
docker compose -f rest-fights/deploy/docker-compose/java17-all-downstream.yml up
Wait for everything to come up
then do curl http://localhost:8082/api/fights/randomfighters
, you should see a successful response, whereas if you do the same with the main
branch you get config errors.
from quarkus.
We had a similar report on reactive messaging. I suspect it is related.
I believe it is unrelated. I tried the fix from the other issue, but the problem remained. I've also tried with Quarkus 3.10.x
, which worked for RM but failed with this scenario. That is why I was asking if it worked previously or if it was something new. I'll investigate.
from quarkus.
It is the same issue, but the reproducer misled me. Remember, to be able to set QUARKUS_STORK__VEHICLE_DATA_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST
, you need the dotted name property quarkus.stork.vehicle.service-discovery.address-list
:
https://quarkus.io/guides/config-reference#environment-variables
There is indeed an issue where the matching is not currently working, which will be fixed by #41318
from quarkus.
Why would it resolve to quarkus.stork.vehicle.service-discovery.address-list
? Shouldn't it resolve to quarkus.stork.vehicle-data-service.service-discovery.address-list
?
from quarkus.
Why would it resolve to
quarkus.stork.vehicle.service-discovery.address-list
? Shouldn't it resolve toquarkus.stork.vehicle-data-service.service-discovery.address-list
?
In your reproducer the env var does not add quotes to VEHICLE_DATA_SERVICE
.
4. export QUARKUS_STORK_VEHICLE_DATA_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST=vpic.nhtsa.dot.gov
So it gets translated to quarkus.stork.vehicle.data.service.service.discovery.address.list
, so the Map
mapping only takes vehicle
as the map key and tries to resolve required configuration under that map key in quarkus.stork.vehicle.service-discovery.type
.
from quarkus.
Got it. I didn't realize I needed the quotes. When using the dot notation (quarkus.stork.vehicle-data-service...
) it works fine. I didn't realize the quotes were required.
from quarkus.
Thank you for the explanation!
from quarkus.
Hey @radcortez I've updated the superheroes app to Quarkus 3.12.2 but this still seems to be broken...I've updated the config:
QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083
QUARKUS_STORK__VILLAIN_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084
QUARKUS_STORK__NARRATION_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087
But yet it still doesn't seem to take. These properties should resolve to
quarkus.stork."hero-service".service-discovery.address-list=rest-heroes:8083
quarkus.stork."villain-service".service-discovery.address-list=rest-villains:8084
quarkus.stork."narration-service".service-discovery.address-list=rest-narration:8087
from quarkus.
What is the error exactly?
I've added exactly that mapping to SmallRye Config tests, and it works as expected:
smallrye/smallrye-config@4863a60
from quarkus.
I'm not getting an error per-se, but the config does not bind properly.
from quarkus.
- Clone https://github.com/quarkusio/quarkus-super-heroes.git
cd rest-fights
docker compose -f deploy/docker-compose/java17-all-downstream.yml up
(or you can usepodman compose
)- Wait for everything to start up
- Try to
curl http://localhost:8082/api/fights/randomfighters
. You'll notice you get the fallback hero & villain:
{
"hero": {
"name": "Fallback hero",
"level": 1,
"picture": "https://dummyimage.com/240x320/1e8fff/ffffff&text=Fallback+Hero",
"powers": "Fallback hero powers"
},
"villain": {
"name": "Fallback villain",
"level": 45,
"picture": "https://dummyimage.com/240x320/b22222/ffffff&text=Fallback+Villain",
"powers": "Fallback villain powers"
}
}
Thats because the default config is to go to localhost
. The compose file overrides this via env variables (https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/deploy/docker-compose/java17-all-downstream.yml#L60-L62):
QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083
QUARKUS_STORK__VILLAIN_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084
QUARKUS_STORK__NARRATION_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087
from quarkus.
Sorry, I was not clear.
When properties override dotted names, the env vars have to follow the same format. So either use:
quarkus.stork.hero-service.service-discovery.address-list
QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST
or
quarkus.stork."hero-service".service-discovery.address-list
QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST
I've just changed the env var to QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST
, and it worked as expected.
We may consider adding a convenience to support mixed quoted mode.
from quarkus.
You're right, it does work. Maybe I mis-interpreted what you have said. I was under the assumption that I needed to use QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST
due to needing "
to wrap the service name (https://quarkus.io/guides/all-config#quarkus-smallrye-stork_quarkus-stork-service-name-service-discovery-type).
But using QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST
does seem to work, which it did before it broke (hence why I created this issue in the first place). Now it seems to work again. Perhaps #41318 was the fix to make that work.
from quarkus.
Related Issues (20)
- Quarkus exits without showing thrown exception when using `-H:ThrowMissingRegistrationErrors=` HOT 1
- Not all Micrometer metrics are available when exporting with Json HOT 3
- Quarkus 3.10 issue with OpenTelemetry? HOT 7
- Customize list of exceptions to unwrap in resteasy-reactive HOT 9
- Performance Issue with MP Rest Client HOT 3
- Kotlin junit ParameterizedTest with list as argument, not working anymore (3.13.0.CR1) HOT 6
- OpenAPI generates wrong example for URLs HOT 3
- ClassCast Exception with Quarkus Hibernate HOT 2
- Our Nightly Quarkus build deploy to Nexus was failing after the gradle upgrade to 8.9 HOT 3
- Update examples to use org.htmlunit:htmlunit HOT 5
- Core module is using a mix of traditional `@ConfigRoot` and `@ConfigMapping` HOT 5
- Support for Demonstrating Proof of Possession (DPoP) in quarkus-oidc HOT 1
- Add OIDC response filters HOT 1
- Quarkus JaCoCo in CD/CI error Error while instrumenting io/quarkus/test/common/*
- Sort identity providers by priority in QuarkusIdentityProviderManagerImpl HOT 3
- ArrayIndexOutOfBoundsException occurred when i was serializing data from redis with quarkus redis extension HOT 6
- Incorrect data in the ReactiveDatasourceHealthCheck being set when the connection is down HOT 1
- Narayana throws an exception when working with the latest MSSQL server
- Native Image run issue with XML Changelog quarkus-liquibase HOT 2
- Extend @TestSecurity to support Credential HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quarkus.