Skip to content
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

include base(); "config://" url handler; #22

Open
carrot-garden opened this issue Jul 10, 2012 · 8 comments
Open

include base(); "config://" url handler; #22

carrot-garden opened this issue Jul 10, 2012 · 8 comments

Comments

@carrot-garden
Copy link

hello;

  1. this is a feature request;

  2. currently, include url()/file()/classpath()
    https://github.com/typesafehub/config/blob/master/HOCON.md#includes

are either relative or absolute, to the specific url:
"otherwise, a file or other resource "adjacent to" the one being parsed"

  1. I suggest to introduce a concept of a "base()" stanza:
    include base("common/server/instance/settings.conf")
    witch represents an idea: include form a root of "common configuration store",
    and is agnostic of url()/file()/classpath() distinctions;

  2. "configuration store" would have to be a new concept for typesafe.config;

  3. base() url handler would have to be provided to the typesafe.config library
    in some external way

  4. another alternative would be to rely on new custom "config://" protocol handler
    explicitly, such as, in this stanza:
    include url("config://common/server/instance/settings.conf")

  5. an example of custom url approach can be found here:
    https://github.com/barchart/barchart-config/tree/master/barchart-conf-base
    https://github.com/barchart/barchart-config/blob/master/barchart-conf-base/src/main/java/com/barchart/conf/impl/ConfigHandlerProvider.java

  6. the benefit of "include base()" in typesafe.config would be to standardize
    the "configuration store" approach to configuration management;

thank you.

@havocp
Copy link
Collaborator

havocp commented Jul 10, 2012

I'm not sure I understand all aspects of the suggestion, but you could add the base config directory to the classpath, right? or maybe there's a reason that a separate "config path" can be useful?

Also it should work to manually include one file from the base config directory, and then have that file include all the others relatively. Should only have to specify the full path to the first "bootstrap" file...

@carrot-garden
Copy link
Author

Havoc, hello:

thanks for considering this; my typesafe.config use-case:

  • there is a need to have multiple karaf instances self-auto-configured
    http://karaf.apache.org/
  • for that, there is central github based configuration repository,
    with 2 branches "master" and "version", they have layout:

"master"
https://github.com/carrot-garden/carrot-config-tester

"version"
https://github.com/carrot-garden/carrot-config-tester/tree/version

thank you;

Andrei.

@havocp
Copy link
Collaborator

havocp commented Jul 10, 2012

Thanks for the detailed use-case, I guess I would need to dig in here a bit. I think the hooks are there and you could use either the custom url protocol or a ConfigIncluder implementation to do this, but both are fairly cumbersome, so some kind of "just extend the search path" convenience feature could certainly make sense. Perhaps it could just be an option added to ConfigParseOptions (say setSearchPath), and also a system property supported in ConfigFactory.load (similar to -Dconfig.file= etc. we could have config.path). Something along those lines, not sure.

@carrot-garden
Copy link
Author

cool; let it cook then :-)

@havocp
Copy link
Collaborator

havocp commented Mar 7, 2015

Also relevant is #202, right now includes are not in fact relative to the including file if you specify url()/file()/classpath().

@briantopping
Copy link

@carrot-garden: I assume you solved this by now, four years later ;) May I ask what you did?

@ajayvkm
Copy link

ajayvkm commented Jun 2, 2021

Hey @havocp (Havoc) and @carrot-garden,
Can we use this Typesafe Library (Lightbend) in a distributed environment? I have a use case to read configuration from GIT similar to Spring Boot Cloud Configuration. Wanted to load configuration properties from Git and a particular Git Branch/Tags. Please let me know if it is possible with this library. Thanks a lot!!

@Anatoliy4041
Copy link

Hi @havocp and @akka-team,

Can we use this Typesafe Library (Lightbend) in a distributed environment? I have a use case to read configuration from GIT similar to Spring Boot Cloud Configuration. Wanted to load configuration properties from Git and a particular Git Branch/Tags. Please let me know if it is possible with this library. Thanks a lot!!

Is there any update on @ajayvkm comment? I would be very useful feature

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

No branches or pull requests

4 participants