Retrieving port number in Play Framework 2 app

后端 未结 3 2202
心在旅途
心在旅途 2021-01-05 09:49

The question is: how do I retrieve the port number that play is listening on, no matter how it was defined (configuration, command line argument, or not at all).

Thi

3条回答
  •  没有蜡笔的小新
    2021-01-05 10:05

    Running in dev mode you need to use doubled notation

    play -Dhttp.port=80 "run 80"
    

    Unfortunately you have to do the same for default port

    play -Dhttp.port=9000 "run 9000"
    

    So I just suggest to write shell script (or .bat in Windows) for easy starting with all required params.

提交回复
热议问题