archaius icon indicating copy to clipboard operation
archaius copied to clipboard

Why doesn't URLConfigurationSource use ConfigurationUtils.getPropertiesFromFile?

Open jakber opened this issue 13 years ago • 6 comments

Currently it seems to me like you cannot use the @next special property in files referenced by the default DynamicURLConfiguration. So out of the box you cannot load cascaded configurations dynamically from URLs, right? Any particular reason for this?

Would you be open to a pull request where instead of loading properties from URLs in the poll method it calls ConfigurationUtils.getPropertiesFromFile to do the loading as well as handling @next?

jakber avatar Oct 22 '13 16:10 jakber

Makes sense to me. There might be some challenges as ConfigurationUtils has assumptions that URLs are file based. It also has the assumption that the subsequent @next URLs have a common URI base. It does not handle absolute URIs.

Feel free to open a pull request.

allenxwang avatar Oct 22 '13 20:10 allenxwang

I am trying to use Archaius out of the box( without programming any Configuration myself) . How can I use Deployment Context and cascaded property files. There are two ways to supply property files to Archaius - One make it default property file which limits to only 1 configuration file(config.properties) other is additional URLs. I tried using additional URL's and supplied property files. Looks like default configuration is not respecting the "archaius.deployment.environment" system parameter.
I know default implementation use URLConfigurationSource.java when you load additional URL'S but it is not cascading the property files.

I tried calling "ConfigurationManager.loadCascadedPropertiesFromResources(configName)" method which actually did the cascading but when i change any value in source property file it does not pick up the change(polling is not working).

Is there any easy way to do following things - a) load more than one property file b) cascade property according to the environment while making sure any update to the source property file will sync the in memory version. c) it could be a stretch but support @next attribute ..

If it requires me creating my own configuration source, can you give any references about the approach ??

abhimaloo avatar Mar 19 '14 05:03 abhimaloo

@abhimaloo In your case, those multiple property files contain the same properties or some files provide override properties over other files? Either way, I believe you can provide multiple cascaded configurations through ConfigurationManager.loadCascadedPropertiesFromResources and/or ConfigurationManager.loadAppOverrideProperties.

As you already pointed out, as of current implementation, polled sources don't support cascading so cascaded resources won't change after load.

If you want to combine cascading with polling, you can look at comments above and I think that provides some leads into a possible solution. I'll look around more. I'll update the thread if I can find more.

howardyuan avatar Mar 19 '14 16:03 howardyuan

Has this consideration seen any traction? I took URLConfigurationSource and created a similar configuration source I embed in a DynamicConfiguration. Consider: https://gist.github.com/swps/3015d304a2d04a5f8941

wendelicious avatar Jun 11 '14 05:06 wendelicious

I ran into this same issue, that is I would like to have dynamic cascaded configuration files. Is there any news on this issue? I see the previous poster submitted a NamedConfigurationSource, has anyone used it?

fiddleatwork avatar Jun 20 '16 09:06 fiddleatwork

In Netflix, the URLConfigurationSource is another REST endpoint. So adding cascading obviously doesn't make sense here. It has been pretty quiet on this thread over the years.

howardyuan avatar Jun 20 '16 14:06 howardyuan