Question

How can I specify a default host and port for Padrino?

Normally I could start my process like this:

padrino start -h myhost

I want to change the default parameters of start. I expected that to be done by editing the config/apps.rb to:

Padrino.mount('MyApp::App', :app_file => Padrino.root('app/app.rb')).to('/').host('myhost')

However with the above line, Rackup still starts listening only on 'localhost'. So I assume that the host() option does not have an effect on Rack at all.

Ideally I would like to set the port/host just for "development" mode, but I cannot find the place where that setting is handed down to the rackup/webrick server.

Was it helpful?

Solution

These options are now defaulted to 127.0.0.1 for security and paranoid reasons.

To rackup here: https://github.com/rack/rack/blob/28b014484a8ac0bbb388e7eaeeef159598ec64fc/lib/rack/server.rb#L187

To padrino s here https://github.com/padrino/padrino-framework/blob/5fe35ccbd2ffbf78d78233e9a47759eff1c6cc92/padrino-core/lib/padrino-core/cli/base.rb#L16

Considering your desire to host development mode app on local Ethernet, you have a dedicated server and you should have no problem setting up something like Passenger to host your app.

BTW, version 1.5.2 of rack still hosts the config.ru on 0.0.0.0, if you are locked on this version you can use rackup to host your development app for local network.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top