Allow to inject some configuration from the Build file to the application in DEV mode#594
Allow to inject some configuration from the Build file to the application in DEV mode#594guillaumebort merged 1 commit intoplayframework:masterfrom guillaumebort:DevSettings
Conversation
|
Nice, thank you. A question: should the setting values be limited to |
|
LGTM. I consider this feature as an extension of the just my 2c. |
|
LGTM. I agree with Peter, this is a mechanism for supplying system properties in dev. |
|
Fair enough. Ship it 👍 |
Allow to inject some configuration from the Build file to the application in DEV mode
|
@brikis98 Actually it would be a bit diffcult to allow more complex Scala types here. Because the build and the runtime can use different version of Scala (For Play 2.1, the build still use Scala 2.9.2 while the runtime uses Scala 2.10), we can't share any Scala value via the SbtLink. If we need something more complex than simple String, we will have to rely on Java only values. |
|
@guillaumebort If the build is still on scala 2.9.2 while the runtime is on 2.10, does that mean you can't share any code between the build and the runtime code? For example, we have a library that's used both in our sbt build code and in our runtime code. If that library was written in Scala, would we have to cross compile it to share it?? |
|
@brikis98 Yes. Java libraries can be shared as is, but Scala libraries must be cross-compiled. |
|
@guillaumebort ouch. Any plans to move the build to 2.10 soon? :) |
|
As soon as there is a version of sbt compiled itself for Scala 2.10 it will be possible. But we will probably release Play 2.1 before that. |
|
Though, while we will be upgrading to Scala 2.10 for builds when SBT supports it, I assume we'll still be maintaining the sbt link and not sharing code between them, so that we aren't held back by SBT in future right? |
As reported in https://play.lighthouseapp.com/projects/82401-play-20/tickets/794-for-discussion-expose-a-new-way-to-get-settings-from-the-build-system-to-a-running-play-app#ticket-794-2, using global Java system properties to override some settings is painful with multi-projects organization.
Let's introduce a new Build setting
devSettings: Seq[(String, String)]to inject some configuration into the Play application at Dev time. These values are seen as standard configuration values.Here is the priority order:
application.confdevSettingsalways override both, the value set inapplication.confor set via a global Java system property.The special setting
config.filecan be used to specify another main application configuration file (the same way the global-Dconfig.file=xxxdoes it currently).Here is a sample: