Play Framework: setting system properties

In the game structure (2.2.1 and sbt 0.13), I have IntegrationSpecone that calls a TestServer. I need to configure special SSL properties for TestServer. So far, the only way I have been able to configure it correctly is to pass them as command line properties like below

play -Djavax.net.ssl.keyStore=... -Djavax.net.ssl.keyStorePassword=.... -D... test

I want the tests to be done simply with play test. For this, in Build.scala, I set up SBT javaOptions as follows

val main = play.Project(appName, appVersion, appDependencies).settings(
    Keys.fork in Test := false,
    javaOptions in Test += "-Dconfig.file=conf/application.test.conf")

And in application.test.conf I set all the properties of the system. It TestServerdoes not even use it application.test.conf. I could not understand why. So I decided to try the following:

play -Dconfig.file=conf/application.test.conf test

TestServerused application.test.conf, but none of the system properties (javax.net.ssl.keyStore = "...", etc.) was configured in the file.

,

  • play test?, ( FakeApplication TestServer).
  • play -Dconfig.file=conf/application.test.conf test, , application.test.conf, ?
+4
1

, , System.setProperty :

System.setProperty("application.secret","psssst!")
0

Source: https://habr.com/ru/post/1531079/


All Articles