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

Quick documentation on using CONF file external to a JAR #84

Closed
igozali opened this issue Sep 11, 2013 · 7 comments
Closed

Quick documentation on using CONF file external to a JAR #84

igozali opened this issue Sep 11, 2013 · 7 comments

Comments

@igozali
Copy link

igozali commented Sep 11, 2013

Hi guys,

I've been scratching my head and trying to find documentation on how to do this.

Basically, I have a standalone, executable JAR which contains a reference.conf in its src/main/resource folder.

I want to be able to pass in an application.conf that is external to this JAR and overrides the resource.conf.

Here's some examples of how I think I should be doing it:

$ ls
standalone.jar    application.conf

$ java -cp standalone.jar com.standalone.Main
Option 1. Running com.standalone.Main with reference.conf included inside the JAR.

$ java -cp standalone.jar:application.conf com.standalone.Main
Option 2. Running com.standalone.Main with application.conf inside the classpath

$ java -cp standalone.jar com.standalone.Main application.conf
Option 3. Running com.standalone.Main with application.conf passed in through command-line arguments

It would be great if you can help me with this, or provide documentation on how to do this, since this seems like something a lot of people might want to do?

Thanks in advance!

@havocp
Copy link
Collaborator

havocp commented Sep 11, 2013

I think you just want -Dconfig.file=/wherever/application.conf or -Dconfig.resource=application.conf as described at https://github.com/typesafehub/config#standard-behavior ?

@igozali
Copy link
Author

igozali commented Sep 11, 2013

Thank you! That is it! :)

Regards,

Ivan Gozali

On Wed, Sep 11, 2013 at 5:54 AM, Havoc Pennington
[email protected] wrote:

I think you just want -Dconfig.file=/wherever/application.conf or -Dconfig.resource=application.conf as described at https://github.com/typesafehub/config#standard-behavior ?

Reply to this email directly or view it on GitHub:
#84 (comment)

@igozali igozali closed this as completed Sep 11, 2013
@gratner
Copy link

gratner commented Jul 7, 2015

@havocp - The above doesn't work for me. I have an app packaged with sbt-assembly. Is there a way to still pass in an external config?

@havocp
Copy link
Collaborator

havocp commented Jul 7, 2015

Should be the same. Maybe ask on stackoverflow, that's a better place for support since it's easier for others to help and easier for future searches to find. I would include though what you are trying exactly, and exactly what goes wrong. The usual problem with sbt-assembly is that filename collisions cause some of the .conf files to be lost from the combined jar. There should be nothing different about an sbt-assembly app unless that has happened.

@gratner
Copy link

gratner commented Jul 7, 2015

@raghu588
Copy link

raghu588 commented Aug 7, 2018

I need to pass a bunch of configuration files in a folder. How do i pass all files at a time externally to a JAR.
Tried with java -Dconfig.file=home/resources/* but not worked.Please advise. @gratner @havocp

@havocp
Copy link
Collaborator

havocp commented Aug 8, 2018

I don't think there's a feature for loading a directory; you'd have to do something like make a .conf file that includes everything in the directory

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

No branches or pull requests

4 participants