0
votes

I'm coding P2P application in Scala which works on Play 2.2.1 with Akka 2.2.3. When I dist my Play project, my project/conf/reference.conf will be included in dist zip. This is okay.

Next, I extracted the ZIP and overwrote conf/reference.conf in order to test for localizing for user environment. However, my application doesn't work using configuration of reference.conf; It still use default settings. (Akka using default settings.)

For example, conf/reference.conf:

p2pakka.akka.remote.netty.tcp.hostname="foobar.local"
p2pakka.akka.remote.netty.tcp.port=44444

Actual behavior:

p2pakka.akka.remote.netty.tcp.hostname="127.0.0.1"
p2pakka.akka.remote.netty.tcp.port=22223

In my code:

val config = ConfigFactory.load()
val customConf = config.getConfig("p2pakka").withFallback({
    println("fallbacking");
    config
})
val system = ActorSystem("foobar", ConfigFactory.load(customConf))
// still using default settings.

As far as using play run, conf/reference.conf exactly works as I wrote.

Are there any wrong with my code? Is conf/reference.conf in zip invalid?

I'd like to know how to applying change in conf/reference.conf by user, after disted by developer. I googled about this problem, but I couldn't find out any answer.


I'm not native English speaker, so please forgive my poor English skill.

1

1 Answers

0
votes

Your code looks fine, Play includes a copy of the config file inside the jar it generates.

If you use

-Dconfig.file=/path/to/prod.conf &

as a command line param (updated path for your env) when starting it should pick up the changes