문제

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?

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top