Domanda

In production Play projects you can selectively override settings by adding another application.conf to the classpath. However this does not seem to work for the development run task. This would be useful so different developers test/work with different settings without affecting the versioned file.

In a non-Play scala project that uses typesefe-config you can do this by adding an additional application.conf in the sbt config:

unmanagedClasspath in Runtime ++= sys.env.get("CUSTOM_CONFIG").map(ec=>Attributed.blank(file(ec))).toSeq

This way each developer can have its own override. However the Play run task doesn't seem to honor this even thought according to sbt inspect it depends on the runtime:unamanagedClasspath setting.

You can of course provide a complete replacement for application.conf but not override just a few entries.

Anyone knows how to do this?

È stato utile?

Soluzione

Create a new config file: /my/local.conf

Within that file:

include "application.conf"

my.custom.setting="hello"

The first line references the application.conf within your classpath. The succeeding line adds/overrides settings.

You the start it with:

sbt -Dconfig.file=/my/local.conf ~run
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top