In Play1.x it was possible to define some conditional routes using the following syntax:
%{ if (play.id == "test") }%
GET /test/derp website.nonproduction.DerpController.index
...
The %{…}% syntax does not compile on Play2 and I cannot seem to find anything in the documentation that discusses conditional routing. Any ideas?
Thanks in advance & good luck with your Play2 migrations!
Routing in Play 2.0 compiles to a class and cannot be dynamic. However, you can wrap the Action block of any development / sensitive endpoints.
You can implement something like Zentasks’s
Securedtrait: https://github.com/playframework/Play20/blob/master/samples/scala/zentasks/app/controllers/Application.scalaSpecifically, to check if Play! is running in Production mode, you can check
Play.application().isProd.