[dancer-users] D2 config.yml ignoring "port"

Russell Jenkins russell.jenkins at strategicdata.com.au
Sat Aug 8 12:32:22 BST 2015


On 8/08/2015 9:08 am, Warren Young wrote:
> I’ve been using D1, and just tried a fresh D2 app, and ran into a TCP port conflict, so I tried adding
>
>     port: 5005
>
> to the config.yml file generated by “dancer2 -a testapp”.  On restarting, it again tries binding to TCP port 5000, not 5005.  I had to pass --port 5005 to plackup to get the setting to take effect.

The port setting only applies if you use the "inbuilt" server in 
Dancer2. This is sometimes useful for one liners or 'app in a script' 
situations and the default port is still 3000. eg:
   perl -E'use Dancer2; get "/" => sub { "Hello" }; dance'

However if you are using one of the PSGI handlers/servers, such as 
plackup (standalone or with Starman, Gazelle, etc.) with the generated 
bin/app.psgi, those servers are responsible for the port binding. In 
this case you need to pass the port as an argument to that server as you 
noted above.

If you think the docs could be clearer about this, we'd really 
appreciate a doc patch!

Hope that helps,
   Russell



More information about the dancer-users mailing list