[Dancer-users] Having an environments/test.yml

Maurice Mengel mauricemengel at gmail.com
Wed Apr 13 01:46:16 CEST 2011


Hi,

i am sure I cannot give you a perfect answer, but apparently I can
give you a quick answer.

It depends on how you deploy. I assume test is something used during
development. I develop using the standalone version. If you do that
then environment should be loaded with this on the shell.


>bin/app.pl --environment=test

maurice


On Tue, Apr 12, 2011 at 4:44 PM, Simon Wistow <simon at thegestalt.org> wrote:
> I want to have some test specific stuff in an environment/test.yml (db
> username and password, memcache prefixes etc etc). Sounds simple enough
> except that in order to get it to work I had to write something like
> this
>
> package Dancer::TestEnviroment;
> use strict;
> use Cwd;
>
> sub import {
>  my $class = shift;
>
>  $ENV{DANCER_ENVIRONMENT} = 'test';
>  $ENV{DANCER_CONFDIR}     = getcwd;
>  unless ($INC{Dancer}) {
>    require Dancer;
>    Dancer->import(@_);
>  }
>  Dancer::setting(appdir  => getcwd);
>  Dancer::Config->load;
> }
>
> 1;
>
>
> and the use that from the top of ever one of my test files. Which seems
> a little ... long winded.
>
> Am I doing something wrong? Is there an easier way to do this?
>
>
> _______________________________________________
> 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