Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
660 views
in Technique[技术] by (71.8m points)

playframework - Does Play support separate routes files per environment - 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")
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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=...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...