0

In IntelliJ, I exported a scala/akka project using "dist". That ends in a zip file, under

foo\target\universal\foo-1.0.0.zip

When I unzip the file, I get following directory structure:

D:.
├───bin
│       foo
│       foo.bat
│
└───lib
        a.jar
        b.jar
        com.foo.jar
        ...
        x.jar

In command line, I'm trying to run the foo.bat, but I'd like to provide external config files.

I'd like to use e.g. application.conf.prod and logback.xml.prod, to override the application.conf and logback.xml files in the com.foo.jar file

I'm using the following versions (copying part of build.sbt):

version := "1.0.0"
scalaVersion := "2.11.8"

"com.typesafe.akka" %% "akka-actor" % "2.4.9"
"com.typesafe.akka" %% "akka-slf4j" % "2.4.9"
"ch.qos.logback" % "logback-classic" % "1.1.6"
"org.apache.kafka" % "kafka-clients" % "0.10.0.0"

Is there a way to do it?

Thanks

XoXo
  • 1,560
  • 1
  • 16
  • 35
  • there's a [post](http://stackoverflow.com/a/17623936/3380951) about using external `reference.conf`, but my question is for `application.conf` and `logback.xml` – XoXo Sep 19 '16 at 19:31

1 Answers1

3

I think you can do this by passing arguments when running your jvm application.

  • For the application.conf you can use -Dconfig.file=/your/path/application.conf

  • For LogBack you can use -Dlogback.configurationFile="/your/path/logback.xml"

hveiga
  • 6,725
  • 7
  • 54
  • 78
  • this works for me. some related answers: [logback](http://stackoverflow.com/a/19519216/3380951) ([official doc](http://logback.qos.ch/manual/configuration.html)), and [akka config](http://stackoverflow.com/a/27355750/3380951) – XoXo Sep 21 '16 at 17:02
  • Related note: [log4j](http://stackoverflow.com/a/7927278/3380951) is different with the `file:` prefix – XoXo Sep 21 '16 at 17:05