[dancer-users] Explicitly defining location of config.yml (current hitch on path to running Dancer as a service)

Nik Mitev nik at mitev.eu
Fri Sep 16 10:56:55 BST 2016


On 16/09/16 10:31, Stefan Hornburg (Racke) wrote:
> On 09/16/2016 11:27 AM, Nik Mitev wrote:
>> Hi,
>>
>> A quick update, to make sure no one wastes time answering my initial question...
>> Location of the config file is not the issue - within my main app file (where the routes are defined), the config hash
>> contains all of the configuration, and the config.yml location. In a plugin I wrote however a part of the configuration
>> is missing - not even all of it.
>> All that's left is for me to figure out why :)
>>
>> Nik
> Hello Nik,
>
> maybe you can share the code of the plugin - so we might spot the problem in there.
>
>
I narrowed it down further (I think). Here is the beginning of the code:

package Dancer2::Plugin::ESS2::Auth;
use strict;
... snip use statements ...
use Dancer2::Plugin;

register ess2_check_user => sub {
    my $dsl = shift;
    my %db_info = %{$dsl->config->{'db_info'}};

... snip ...
};

.... more register statements ...
register_plugin;
1;

If I edit the above to

    my $dsl = shift;
+ print Dumper $dsl;

I get all the information I would expect to be under the config key, e.g.
'config' => {
                      'plugins' => {
                                             'ESS2::Auth' => {
                                                                       
    all the data from the plugin config
                                                                        },
                                           },
                     'db_info' => {
                                            the database connection settings
                                          },
etc ...
                   },

Dumping $dsl->config however returns only the contents of
$dsl->config->{'plugins'}->{'ESS2::Auth'}
when I would expect it to return the 'plugins' key and the 'db_info' key
and the rest of it.

Thanks for any and all input :)

Nik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20160916/f2692cf5/attachment.sig>


More information about the dancer-users mailing list