[Dancer-users] reusing config.yml with environments

Dave Doyle dave.s.doyle at gmail.com
Thu Feb 10 05:23:19 CET 2011


Hiya,

This may be a colossally stupid question.  I have a webapp that has many
nifty things in config.yml and different settings based on the envirnoment.
 I'd like to use the Dancer config for cli utilities (a data loader for
example) and not have to manually munge together the config.yml and the
envinroment/<whatever>.yml.  I don't want to use YAML, load the config.yml,
find the environment, find the environment config file, load it and merge it
with the main config... because Dancer already does that.

Now, something like this works for a script I've got in a "scripts" folder
off the root of my Dancer app:

#!/usr/bin/perl

use common::sense;
use FindBin;
use Data::Dumper::Concise;

use Dancer ':syntax';
use Dancer::Config;

set appdir => "$FindBin::Bin/../";
set environment => 'production';
Dancer::Config->load();

say Dumper(config);


This does it just fine.  Granted, it's relatively small but it seems klugy
to me.  Anyone else done something like this?  How do you do it?  Is there a
better way?  Am I utterly blind?

Thanks,
D
aka meraxes
--
dave.s.doyle at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110209/dc5b435a/attachment.htm>


More information about the Dancer-users mailing list