-
Notifications
You must be signed in to change notification settings - Fork 116
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
Support external configuration files #422
Comments
Like for #418 please use a prefix of e.g. |
Relying on a system property can be problematic, if more than one application exists in the run time. Does the external file then apply to all configurations? How does one exclude it? Etc. I think the container ought to be responsible for providing this feature because sometimes it will make sense and sometimes it will not. |
We discussed this issue at today's hangout with @jmesnil @kenfinnigan. This sounds a good approach to feed in config properties at different stage. |
What is the default ordinal for this file if the file itself does not define the property ordinal? @jmesnil suggested to use 400-1. |
Hello, I have a question : Why 400-1 and not 500 ? Regards |
You want more space than just one to allow user-defined sources to be inserted in between config sources. The point of specifying spacing between config source ordinals in the specification is to do exactly that. |
Also, this feature really can't be implemented until the above questions are answered. |
If more than one apps for this server, this configuration should applicable to each app. Each application should create one config source object of course. |
We don't presently have a way for a configuration source to use other configuration sources to configure themselves. See #470 for more info. |
Since system property is having the ordinal of 400, when you pass in the configsource via the command line, you might want to override the system properties. Personally, I think having the default ordinal of 500 makes sense. By the way, you can config this ordinal by adding a property of config_ordinal in the config source. |
maybe use 450 as the |
@LittleWing we discussed today. Will #418 solve your issue? If not, can you specify your use case clearly so that we can understand what you are trying to achieve? |
Hello @Emily-Jiang . I'm available for further informations if needed. Regards |
Hi @LittleWing Not exactly. While #418, gives the idea to apply profiles to files, it wouldn't be specced that way because of obvious limitations. The current proposal is to support them at the configuration level, so this will allow you to specify any profile in any ConfigSource and not only file based config sources. |
OK got it. |
With the current proposal of #418, will it be enough for your use case @LittleWing ? |
If the #418 proposal enables using any ConfigSource even from external sources then I will be "enough". Thanks |
Yes, that the idea. Thank you :) |
@LittleWing this is easily done with a custom ConfigSource that reads property files. Payara Micro supports that through I suppose a bigger question is whether we want to specify more config sources? |
@LittleWing, I don't see how #418 solves this? #418 adds an option to specify different values for different profiles for the existing config sources. It won't allow reading values from an external config file. For that, we would have to define an additional standard config source so that you don't have to rely on a non-standard config source like @smillidge described. #418 only allows creating an additional properties file inside the app that would be used when a specific profile is selected. Alternative proposal would allow specifying profile-specific values in config sources. There are only 3 standard config sources: properties files inside the app, system properties and environment variables. Or am I wrong and I just don't see how #418 solves your usecase? Can you explain? |
Hello, |
You can do it today by specifying config properties in k8s config map and directly map the configmap to env, which makes all config properties available to your microservices. e.g.
In k8s deployment yaml:
What I would also want to mention here. There is another support I would like to propose for #418 is to support config source overriden at a file level.
if |
I think what you proposed is to automatically load a config source without doing the service loader patter and directly load that all properties contained in a config source. At the moment, you can use You want to load a whole file and treat all properties inside the file as config properties instead of specifying individual config properties. @smillidge mentioned to load the files as system properties in Payara, we could also load the config source as a config source other than system properties with the specified config source ordinal. |
Hello,
For few properties it's OK, when you have several properties, it could be a nightmare to deal with.
java -jar my_app.jar -Dconfig=microservice-config.properties |
To understand better, should a file passed in For what it seems, you want the ability to pass a file, but also override? |
Hello, Just as a comparison, the existing spring boot analog feature is really useful on a daily basis (for devs and ops). |
From my understanding, -Dconfig=fully.qualified.propertie.file. It supplies a fully qualified property file and it has no clash with microprofile-config.properties. It just adds additional properties. The file itself has its own ordinal (containing
It just provides a way to pass in the config file instead of creating service loader for it. |
To summarise this issue, I would like to make the following proposal is:
e.g.
/etc/myExtraConfig.properties
The system property config source will have the following properties
@alexandre-touret does this solve your problem? |
Hello, Thanks @Emily-Jiang for your proposal. Regards |
@Emily-Jiang you did not fully update your example in #422 (comment) consistently using |
@jbee thanks, I have now updated all occurences. |
Hello,
In addition of this issue, it could be nice to support external configuration files. I usually externalize all the configuration files from WAR/JAR in order to handle multi environment deployments with the same artifact ( DEV -> PROD ).
For instance, when we run the application, I could apply the configuration files as following :
Thanks
Regards
Alexandre Touret
The text was updated successfully, but these errors were encountered: