[Catalyst] Merging configs

Christopher H. Laco claco at chrislaco.com
Thu Mar 8 22:25:55 GMT 2007


Bill Moseley wrote:
> My YAML file has sections that are specific to what server
> is running.  That is, I have:
> =

> # Default config
> foo: bar
> name: foo
> =

> 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.
> =

> =

> Now, my YAML config also configures my View::TT, for example:
> =

> V::TT:
>     WRAPPER: page/wrapper.tt
>     PRE_PROCESS: config.tt
>     TEMPLATE_EXTENSION: .tt
>     PRE_CHOMP: 0
>     POST_CHOMP: 0
>     TIMER: 0
> =

> and I'd like to be able to do something like this:
> =

> =

> servers:
>     devel:
>         config:
>             V::TT:
>                 DEBUG: provider
>                 BLA: 123
> =

> but that shallow merge above wipes out the initial V::TT settings.
> =

> Is the answer Hash::Merge?  Or does Catalyst have anything to help
> here?
> =


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

-=3DChris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070308/7d9e=
ecb9/signature.pgp


More information about the Catalyst mailing list