-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom config source is not working in Quarkus 2.0.0 #18375
Comments
/cc @radcortez |
Relates with #18237. We removed the ability to discover sources during static init, because some sources would not work due to required services not being available. Since Config is the first thing we need to initialize, if we need to connect to a database, the database resource would not be available, so this is mostly a chicken/egg problem. In this particular case, the RESTEasy Exception mapper is added in static init, so it causes the problem. @ennishol looking into the reproducer, it seems that you want to activate custom In the meanwhile, I'll need to check if there is something we could do in RESTEasy. |
@radcortez yes, loading specific file based on some env variable (not profile, like staging, dev or production) is my use case. In other words, I want to select config file, inside of which I'd be able to define overrides for specific profile: export CONFIG_TYPE=a ---> application-a.properties is loaded with content: export CONFIG_TYPE=b ---> application-b.properties is loaded with content: |
Have you tried multiple profiles https://smallrye.io/docs/smallrye-config/config/config.html#_multiple_profiles? In that way, you should be able to keep the Quakus profile and add your own. |
@radcortez No I didn't know about multiple profiles. I will try that out. Thank you! |
Great. Let me know if that works. If that works for you then you should be able to set up the RESTEasy provider using the default sources. In the meanwhile, I'm prototyping something to support the custom sources when they are needed. |
@radcortez I think it would work, but maintaining the configs with multiple profiles is a bit cumbersome. It would be really great if it would be possible to select config file per deployment as described above. It is really nice to have them isolated on the file level |
I think it should work. When you pass in the multiple profiles, it will load any file with any profile in the name, but also the profile property names inside the file. So you use the something like Another alternative is to use
Then, you can use |
created However, |
Most likely the issue is related with the location of the file. When you pass a relative path, it uses the working directory of the quarkus application. So to be safe, just use the absolute path. |
@radcortez The documentaion states: Only a single profile may be active at a time. This is incorrect, right? |
It is possible to have multiple profiles at a time, but this is provided by SR Config and not Quarkus. Quarkus was written with a single profile in mind, so some extensions may not be aware of the multi-profile capabilities of SR Config, so we prefer to just say a single profile in Quarkus to be safe :) |
I see... On the other hand, I'd like to be safe too. So I have to move back to my custom config source as soon as the fix will be available. |
Describe the bug
Custom config source is loaded but afterward,
the exception is thrown:
java.util.NoSuchElementException: SRCFG00014: The config property some.key is required but it could not be found in any config source.
Expected behavior
Config values must be loaded and used
Actual behavior
Config values are loaded but not used, NoSuchElementException is thrown
To Reproduce
Steps to reproduce the behavior:
rest-json-quickstart.tar.gz
Custom config source selects application-*.properties file based on CONFIG_TYPE env variable:
The text was updated successfully, but these errors were encountered: