[Catalyst] Access config values

Jason Kohles email at jasonkohles.com
Thu Jan 29 17:39:48 GMT 2009


On Jan 29, 2009, at 7:18 AM, Dermot wrote:

> Rats, Sorry I have read a thread on this in the past but I can't  
> find it.
>
> I want to set the dsn vaules in my app conf (config general) alone.
> The values are
>
> <MyApp::DB>
>        connect_info dbi:SQLite:/var/db/myapp/myapp.db
>        connect_info dummy username
> </MyApp::DB>
>
> How can I get these to values in my Schema config, which currently
> looks like this.
>
> use base 'Catalyst::Model::DBIC::Schema';
>
> __PACKAGE__->config(
>    schema_class => 'MyApp::Schema',
>    connect_info => [ 'dbi:SQLite:/var/db/myapp/myapp.db' ],
> );
>
> Is there a way to pass config->connect_info those values from my conf.

__PACKAGE__->config(
     schema_class => 'MyApp::Schema',
     connect_info => MyApp->config->{ 'MyApp::DB' }->{ 'connect_info' },
);

-- 
Jason Kohles, RHCA RHCDS RHCE
email at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire





More information about the Catalyst mailing list