[Dancer-users] Dancer.pm sets confdir too early

Alexis Sukrieh sukria at sukria.net
Mon Apr 26 16:25:17 CEST 2010

[ CC'ing the list ]

Le lundi 26 avril 2010 à 15:50 +0200, Stéphane a écrit :
> In latest git, Dancer.pm at line 148 does:
>      setting confdir => $ENV{DANCER_CONFDIR} || setting('appdir');
> however this overrides what Dancer::Config->load() (especially this 
> means init_confdir() never get a chance to run).
> Basically I'd like to be able to do:
>    use Dancer ':syntax';
>    set confdir => MyApp::confdir; # e.g. /etc/myapp/config.yml
>    use Dancer;
> but currently this gets overriden by Dancer->import().

No, you can't do that. It has never been possible to set the confdir via
the "set" keyword as Dancer needs to parse configuration files at import

The only supported way for using a separate confdir is to use the
DANCER_CONFDIR environment variable.

If you're running with the standalone server, just run it like:

    $ DANCER_CONFDIR=/etc/myapp ./server.pl ...

Or under Apache, use SetEnv to set DANCER_CONFDIR.

Changing that specific setting within the application code is not
possible because if we allow that, we can't parse the configuration at
load time.


Alexis Sukrieh

More information about the Dancer-users mailing list