-
How do I map properties containing a hyphen into an environment variable? I've read through the MicroProfile Config environment variable mapping rules and can't seem to figure out how to map a property containing a hyphen correctly to an environment variable. I have an application that uses the MicroProfile REST client and am trying to create a docker compose file for that. The docker compose needs to override the URL property via an environment variable. The property in question is I've tried The only thing I've been able to get to work is this environment:
QUARKUS_DATASOURCE_REACTIVE_URL: postgresql://fights-db:5432/fights_database
KAFKA_BOOTSTRAP_SERVERS: PLAINTEXT://fights-kafka:9092
quarkus.rest-client.hero-client.url: http://rest-heroes-java11:8083 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 16 replies
-
I think your solution is right as that works for #1 rule about exact match in the microprofile docs. using the - to _ rule works one way but is lossy the other. I don't think there is another way here. @radcortez any suggestions ? |
Beta Was this translation helpful? Give feedback.
-
Yes, the issue with the In this situation, we don't know where to map
So we added another trick (if I remember correctly), which is if you add the dotted version of the property ( |
Beta Was this translation helpful? Give feedback.
Yes, the issue with the
-
(or other chars) in env variables is that they cannot be fully represented. We have a few tricks, like for instance quotes can be represented with a double underscore.In this situation, we don't know where to map
QUARKUS_REST_CLIENT_HERO_CLIENT_URL
(there are multiple candidates):quarkus.rest-client.hero-client.url
quarkus.rest.client.hero.client.url
quarkus.rest.client.hero-client.url
quarkus.rest-client.hero.client.url
So we added another trick (if I remember correctly), which is if you add the dotted version of the property (
quarkus.rest-client.hero-client.url
) inapplication.properties
or any other source for that matter, then we "guess" thatQUARKUS_REST…