In my Quarkus application, I don't want passwords to be versionned by Git.
I don't have any issue with the prod profile because I have a config file in $PWD/config/application.properties. Fine.
For the dev profile, I'm using the .env approach which contains properties such as :
QUARKUS_DATASOURCE_PASSWORD=foo
I'm trying to setup tests and I need some separate conf for tests.
So I have the following config in my src/test/resources/application.properties :
%test.quarkus.datasource.password=bar
Unfortunately, the test value (bar) is overriden by the .env value (foo) which is supposed to be dedicated to the dev profile.
I don't find an elegant way to fix it.
Based on https://quarkus.io/guides/config#overriding-properties-at-runtime I have 5 possible approachs:
- "using system properties": I'd prefer to have a file for that, so each developer can have its own file and no need to adapt the command line before launch ;
- "using environment variables": Same reason ;
.envfile: Could work, but I can't specifiy value fordevprofile only (aka%dev.[...]) ;$PWD/config/application.propertiesfile: well, this is for dev mode, I don't find it convinient as target is cleared and I have to copy again theconfigfolder after eachmvn clean;- Create my own
ConfigSourceorConfigSourceProvider. I know this one could work, but I prefer to avoid doing specific stuff in my project, and stay with the builtin Quarkus config.
I just found that I was wrong about that :
It is possible to have custom profile values in
.envfile :As I can prefix the property with
_DEV_[...], this value is fordevprofile only: thetestproperty is not overriden anymore.