[Dancer-users] reusing config.yml with environments

Иван Бессарабов ivan at bessarabov.ru
Mon Feb 14 18:17:57 CET 2011


For what I know the dancer has no user friendly way of using config
values outside dancer webapp.
I'm just using YAML to manually parse config. I think this is the part
where the dancer should help the user.

I hope that somebody will write code that will solve this small issue
(as we know there is a great myth about dancer, that one should only
suggest plugin in the mail list and sooner or later the code will be
on cpan =).

2011/2/10 Dave Doyle <dave.s.doyle at gmail.com>:
> 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
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>


More information about the Dancer-users mailing list