[Dancer-users] Sharing config files

David Precious davidp at preshweb.co.uk
Tue Nov 15 11:44:01 CET 2011


On Tuesday 15 November 2011 10:42:21 David Precious wrote: 
> In the meantime, you could store your database settings in a separate YAML
> file, then in your apps, load that and put it into the app's config with
> something a little like:
> 
>     my $db_conf = YAML::LoadFile('database.yml');
>     config->{plugins}{Database} = $db_conf;
> 
> That should work :)

And of course that could be even more concise using the from_yaml() keyword 
provided by Dancer, e.g.:

    config->{plugins}{Database} = from_yaml('database.yml');


-- 
David Precious  ("bigpresh")
http://www.preshweb.co.uk/

   "Programming is like sex. One mistake and you have to support
   it for the rest of your life". (Michael Sinz)


More information about the Dancer-users mailing list