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

No support for JVM properties and environment variables #128

etki opened this Issue Mar 30, 2016 · 5 comments


None yet
3 participants

etki commented Mar 30, 2016


I couldn't find any documentation reference for including JVM properties and good old environment variables as configuration source. Due to the popularization of Docker philosophy and 12-factor application concept it would be quite nice to provide library users with simple way to use both sources in their apps. I've already found a workaround with InMemoryConfigurationSource (and i know that documentation will become confusing the very moment it will specify word 'environment' in two meanings), however, i feel that is necessary to update library in that way (or at least mention InMemoryConfigurationSource workaround in documentation).


This comment has been minimized.


norbertpotocki commented Mar 31, 2016

That's a good catch. JVM and environment properties are not supported as of now. I'll try to add it soon.

@norbertpotocki norbertpotocki self-assigned this Mar 31, 2016

@norbertpotocki norbertpotocki added this to the v4.2.0 milestone Mar 31, 2016

@norbertpotocki norbertpotocki changed the title from No documentation (or support) for JVM properties and environment variables to No support for JVM properties and environment variables Mar 31, 2016

@norbertpotocki norbertpotocki modified the milestones: v.4.3.0, v4.2.0 Apr 5, 2016


This comment has been minimized.

fromanator commented Apr 8, 2016

This would be super helpful to have, since it would allow for easy integration with 12 Factor Application Configuration conventions. For the EnvironmentVariableSource it would make sense for the Environment to define the prefixed namespace for the Environment Variables that you are interested in.

For example if you had and application name foo, with configurable properties bar and baz, you would format your environment in the following manner:

Thus if you have the Environment context set to FOO then I would expect the EnvironmentVariableSource would only return: BAR and BAZ along with their corresponding value.

Let me know what you think. I wouldn't mind working on implementing this feature since, selfishly, this would be very useful for what I need to do. I am looking into using envconsul to insert the config from Consul and Environment variables, instead of using the ConsulConfigurationSource. I figured this will be much more flexible since we have applications not running on a JVM (like nodeJS) and this would provide a more consistent way to configure applications from Consul. And I could then use cfg4j to implement loading the configuration from Environment Variables and overlaying it with local config files etc nicely for our JVM based applications. Other non JVM applications will have to use a different library of course, but the means for retrieving the configuration will be more consistent this way :)


This comment has been minimized.


norbertpotocki commented Apr 13, 2016

I like this approach a lot. Thanks for working on it.


This comment has been minimized.


norbertpotocki commented Apr 19, 2016

@etki this is now supported by the cfg4j 4.3.0 :)


This comment has been minimized.

etki commented Apr 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment