Paddy
Paddy

Reputation: 61

port definition in the play framework 2 application.conf

Does anybody know if it is possible to define the http port in the application.conf file of a Play Framework 2 app?

Upvotes: 2

Views: 1043

Answers (1)

biesior
biesior

Reputation: 55798

In Play 2.x port is set while running/starting the application in the commandline (or in Play's console)

Examples:

  1. Running application in dev mode with port 9123:

    bash#: play "~run 9123"
    
  2. Starting application in production mode on port 9321:

    bash#: play "start 9321"
    
  3. You can do the same by firing console first, and than writing the command placed in quotes in previous points:

    bash#: play 
    
    #(after console's load)
    [your-new-app] $ ~run 9123
    

of course if you are always using specified ports, it's good idea to write a shell script (or *.bat file on Windows) and name them like run-local-dev.sh, start-local-prod.sh etc.

Upvotes: 4

Related Questions