Play 是否支持每个环境的单独路由文件 - dev、uat、prod? [英] Does Play support separate routes files per environment - dev, uat, prod?

查看:19
本文介绍了Play 是否支持每个环境的单独路由文件 - dev、uat、prod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is it possible to have the following routing in dev mode:

GET  /       controllers.Assets.at(path="/public/ui/dev", file="index.html")
GET  /*file  controllers.Assets.at(path="/public/ui/dev", file)

以及生产中的以下内容:

and the following in production:

GET  /       controllers.Assets.at(path="/public/ui/prod", file="index.html")

推荐答案

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

Yes it is possible. Declare your dev routes in conf/routes, but declare your production routes in conf/prod.routes. Then, have a production configuration file, conf/prod.conf, and put this in it:

include "application.conf"

application.router = "prod.Routes"

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

Now, when you start your application in production, simply use:

path/to/myapp/bin/myapp -Dconfig.resource=prod.conf -Dhttp.port=...

这篇关于Play 是否支持每个环境的单独路由文件 - dev、uat、prod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆