[Catalyst] model connect info to come from YAML configuration file

John Napiorkowski jjn1056 at yahoo.com
Tue Dec 5 14:29:50 GMT 2006


-- Brian Cassidy <brian.cassidy at nald.ca> wrote:

> Hermida, Leandro wrote:
> > Inside MyApp::Model::MyAppDB:
> >
> > use strict;
> > use base 'Catalyst::Model::DBIC::Schema';
> >
> > __PACKAGE__->config(
> >     schema_class => 'MyAppDB',
> >     connect_info => [
> >         'dbi:SQLite:myapp.db',
> >         '',
> >         '',
> >         { AutoCommit => 1 },
> >         
> >     ],
> > );
> >   
> 
> Model::MyAppDB:
>   schema_class: MyAppDB
>   connect_info:
>     - dbi:SQLite:myapp.db
>     - ''
>     - ''
>     - AutoCommit: 1
> 
> -Brian

If you like putting your database config info in the
general config area, you might want to consider using
'myapp'_local.yaml for database and other config stuff
that changes from box to box (if you are using the
configloader plugin).  That way you split up the
configuration that is application and configuration
that is part of your local setup.

Configloader gives you quite a few options for this. 
You can even setup something like:

myapp.yml
myapp_dev.yml
myapp_qa.yml
mypp_prod.yml

and use a environment variable to choose the postfix
for the local configuration.

Read more about it at:
http://search.cpan.org/~bricas/Catalyst-Plugin-ConfigLoader-0.13/lib/Catalyst/Plugin/ConfigLoader.pm

if you are interested.
> 
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 



 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.



More information about the Catalyst mailing list