Play是否支持每个环境单独的路由文件 - dev,uat,prod?

ree*_*een 6 playframework

是否可以在开发模式下进行以下路由:

GET  /       controllers.Assets.at(path="/public/ui/dev", file="index.html")
GET  /*file  controllers.Assets.at(path="/public/ui/dev", file)
Run Code Online (Sandbox Code Playgroud)

以及生产中的以下内容:

GET  /       controllers.Assets.at(path="/public/ui/prod", file="index.html")
Run Code Online (Sandbox Code Playgroud)

Jam*_*per 9

对的,这是可能的.声明你的开发路线conf/routes,但申报你的生产路线conf/prod.routes.然后,有一个生产配置文件conf/prod.conf,并将其放入其中:

include "application.conf"

application.router = "prod.Routes"
Run Code Online (Sandbox Code Playgroud)

现在,当您在生产中启动应用程序时,只需使用:

path/to/myapp/bin/myapp -Dconfig.resource=prod.conf -Dhttp.port=...
Run Code Online (Sandbox Code Playgroud)