[Catalyst] Merging configs

Carl Vincent c.a.vincent at newcastle.ac.uk
Fri Mar 9 10:12:38 GMT 2007


>-----Original Message-----
>From: Christopher H. Laco [mailto:claco at chrislaco.com] 
>Sent: 08 March 2007 22:26
>Subject: Re: [Catalyst] Merging configs
>
>Bill Moseley wrote:
>> My YAML file has sections that are specific to what server
>> is running.  That is, I have:
>> 
>> servers:
>>     staging:
>>         config:
>>             foo: baz
>>     devel:
>>         config:
>>     production:
>>         config:
>> 
>> So in my setup() I do basically:
>>     $self->config( $self->config->{servers}{$server_mode}{config} );
>> Of course, that's a shallow hash merge.

>Catalyst config support a 'local' config file in addition to 
>the regular
>one. I'm not sure on the exact file name, but I think it's 
>myapp_local.yml

It's configurable - though the default is 'local'. We set it with
environment variables to pull in the appropriate config 'overlay' for
the server, so you can have test, devel, qa, production configs.

CATALYST_CONFIG_LOCAL_SUFFIX}=test ./script/myapp_server.pl

or in .t files:

BEGIN {
$ENV{CATALYST_CONFIG_LOCAL_SUFFIX}='test';
}

It's another powerful labour-saving feature of Catalyst!

Cheers

Carl
(IRC: CaptainCarlos)

-- 
     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     Carl Vincent             http://www.netskills.ac.uk/ (URL)
     Systems Manager                       0191 222 5003 (voice)
     Netskills, Newcastle University       0191 222 5001  (fax)
     Training  -  Accreditation  -  Consultancy  -  Development



More information about the Catalyst mailing list