[Mongrel] Question for Zed

Matt Pelletier matt at eastmedia.com
Mon Oct 30 07:13:12 EST 2006

On Oct 29, 2006, at 1:54 AM, Zed A. Shaw wrote:

> On Sat, 28 Oct 2006 21:23:08 -0400
> "Wayne E. Seguin" <wayneeseguin at gmail.com> wrote:
>> Zed,
>> I purchased your book and was reading through it. On page 25 it  
>> states:
>> "Mongrel will give precedence to the parameter values in the config
>> file over those in the command line."
>> I was wondering why this is not the other way around, preference
>> given to the command line options.
> It's kind of a legacy thing about how the defaults were  
> implemented.  Short version of the story was it was too hard to  
> merge defaults and figure out what people mean.  I kept running  
> into options that some folks felt should always be from the config  
> file, others from the command line.
> To keep it simple I just say use either or but not both.  And then  
> wrote the -G option so generating the config files is super easy.   
> That seems to be the best approach.


The way this works is that -G generates the Yaml to include tuples  
for each of the available options, including those not specified.  
When you run Mongrel with -C, the command line options hash, which is  
loaded first, is updated with config file's parameters hash, so even  
nil values overwrite the passed in ones (this is just normal hash  
merging behavior).

This means if you want to manually edit the generated config file and  
remove some of the empty tuples, you could include command line  
parameters that wouldn't be overridden. WARNING: this is not a  
supported feature, just an incidental one. You can see how this works  
in the mongrel_rails script source.


> -- 
> Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
> http://www.zedshaw.com/
> http://safari.oreilly.com/0321483502 -- The Mongrel Book
> http://mongrel.rubyforge.org/
> http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

Matt Pelletier
http://www.eastmedia.com -- EastMedia
http://safari.oreilly.com/0321483502 -- The Mongrel Book
http://identity.eastmedia.com -- OpenID, Identity 2.0

More information about the Mongrel-users mailing list