[Mongrel] Mongrel script and config options

Luis Lavena luislavena at gmail.com
Tue Apr 13 22:04:51 EDT 2010

On Tue, Apr 13, 2010 at 10:49 PM, Pete <pete at kapiti.co.nz> wrote:
>> 2) Use something like MYAPP_TARGET=foo in the command line:
>> mongrel_rails start MYAPP_TARGET=foo
>> Will get you something like this:
>> ** Starting Mongrel listening at
>> ** Starting Rails with development environment...
>> ["MYAPP_TARGET =foo"]
>> ["MYAPP_TARGET =foo"]
>> ** Rails loaded.
>> ** Loading any Rails specific GemPlugins
>> (dunno why appears twice, is like the file gets "loaded" instead of
>> required)
> **************
> *** WOW!!! ***
> **************
> I had no idea that would work. What are these things called? They're not
> really options, are they?

They are coming from ARGV, are not parsed by OptionParse (used by
mongrel), so are just ignored and left available in ARGV.

> Just tried it out and not only can I trap these options easily using
> preinitialize.rb with mongrel_service as well as mongrel_rails, but it also
> works perfectly fine in script/server (sorry, I know you don't like this and
> I trust your judgement, but it is the only option I have when debugging
> under Netbeans).

Hehe, well, if works for you for debugging will not say anything :)


Glad to hear that.

> I missed this feature completely or it is undocumented. Had I known that a
> couple of weeks back I could have spent a week at the beach and would still
> be further than I am now.

config/preinitializer.rb is a hidden feature that actually nobody
knows of it. It started to be more noticeable with the appearance of

Apologizes for you spending your time doing this, the mailing list
should have been more exposed :(

> Now I've also noticed that mongrel_rails service::install doesn't complain
> at all if I specify such glyphs (like MYAPP_TARGET=foo). However, they are
> not added to the ImagePath. If you think this would be useful, I see if I
> can fix it and submit a patch?

These options are not carried over. A minor patch that takes the left
overs of ARGV and append to the registry line could work.

Add the gist link with the diff to the mongrel_service GitHub issue,
I'll get that integrated ;-)

> Many thanks again, its hugely appreciated.

You're welcome :)

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the Mongrel-users mailing list