config.yml:
> ElasticSearch:
>     servers: "10.10.10.33:9200"
>     transport: "httplite"
>     max_requests: 10000
>     trace_calls: 0
>     no_refresh: 0
lib/App.pm:
>use lib "$Bin/../lib";
>use App::A;
>use App::B;
lib/App/A.pm:
>use Dancer ':syntax';
>use ElasticSearch;
>my $elsearch = ElasticSearch->new( config->{ElasticSearch} );
>prefix '/a';
>get '/config' => sub { return Dumper $elsearch };
lib/App/B.pm:
>use Dancer ':syntax';
>use ElasticSearch;
>my $elsearch = ElasticSearch->new( config->{ElasticSearch} );
>prefix '/b';
>get '/config' => sub { return Dumper $elsearch };

Then `get http://localhost:3000/a/config` show that servers: "10.10.10.33:9200" but `get http://localhost:3000/b/config` show that servers: "127.0.0.1:9200" which is the default setting of ElasticSearch module.



2012/12/10 <dancer-users-request@dancer.pm>
Send dancer-users mailing list submissions to
        dancer-users@dancer.pm

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
or, via email, send a message with subject or body 'help' to
        dancer-users-request@dancer.pm

You can reach the person managing the list at
        dancer-users-owner@dancer.pm

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dancer-users digest..."


Today's Topics:

   1. Can I write own config in config.yml? (chenlin rao)
   2. Re: Can I write own config in config.yml? (David Precious)
   3. Re: Can I write own config in config.yml? (David Precious)


----------------------------------------------------------------------

Message: 1
Date: Mon, 10 Dec 2012 16:56:46 +0800
From: chenlin rao <rao.chenlin@gmail.com>
Subject: [dancer-users] Can I write own config in config.yml?
To: dancer-users@perldancer.org
Message-ID:
        <CABwsoohczVCJwVxZcFUqPaS2KdxsK8-rE-V0=TeJEmDEPr4r5w@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I try to write my own elasticsearch config in config.yml:

ElasticSearch:
    servers: "10.10.10.33:9200"
    transport: "httplite"
    max_requests: 10000
    trace_calls: 0
    no_refresh: 0

But after I got the right `config->{ElasticSearch}` in my
lib/DancerApp/A.pm, I got `config->{ElasticSearch}` in my
lib/DancerApp/B.pm returns only one line as 'trace_calls:0'.

I try to got config->{appdir} at multi sub and got right result everywhere.

Why??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20121210/85f94448/attachment.html>

------------------------------

Message: 2
Date: Mon, 10 Dec 2012 10:46:51 +0000
From: David Precious <davidp@preshweb.co.uk>
Subject: Re: [dancer-users] Can I write own config in config.yml?
To: Perl Dancer users mailing list <dancer-users@dancer.pm>,
        dancer-users@perldancer.org
Message-ID: <20121210104651.65d2c92f@columbia>
Content-Type: text/plain; charset=US-ASCII

On Mon, 10 Dec 2012 16:56:46 +0800
chenlin rao <rao.chenlin@gmail.com> wrote:

> I try to write my own elasticsearch config in config.yml:
>
> ElasticSearch:
>     servers: "10.10.10.33:9200"
>     transport: "httplite"
>     max_requests: 10000
>     trace_calls: 0
>     no_refresh: 0

That looks fine.

> But after I got the right `config->{ElasticSearch}` in my
> lib/DancerApp/A.pm, I got `config->{ElasticSearch}` in my
> lib/DancerApp/B.pm returns only one line as 'trace_calls:0'.
>
> I try to got config->{appdir} at multi sub and got right result
> everywhere.
>
> Why??

Can you show your code?  config->{ElasticSearch} should give you the
same in each case, unless it's being modified by something.


--
David Precious ("bigpresh") <davidp@preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




------------------------------

Message: 3
Date: Mon, 10 Dec 2012 10:46:51 +0000
From: David Precious <davidp@preshweb.co.uk>
Subject: Re: [dancer-users] Can I write own config in config.yml?
To: Perl Dancer users mailing list <dancer-users@dancer.pm>,
        dancer-users@perldancer.org
Message-ID: <20121210104651.65d2c92f@columbia>
Content-Type: text/plain; charset=US-ASCII

On Mon, 10 Dec 2012 16:56:46 +0800
chenlin rao <rao.chenlin@gmail.com> wrote:

> I try to write my own elasticsearch config in config.yml:
>
> ElasticSearch:
>     servers: "10.10.10.33:9200"
>     transport: "httplite"
>     max_requests: 10000
>     trace_calls: 0
>     no_refresh: 0

That looks fine.

> But after I got the right `config->{ElasticSearch}` in my
> lib/DancerApp/A.pm, I got `config->{ElasticSearch}` in my
> lib/DancerApp/B.pm returns only one line as 'trace_calls:0'.
>
> I try to got config->{appdir} at multi sub and got right result
> everywhere.
>
> Why??

Can you show your code?  config->{ElasticSearch} should give you the
same in each case, unless it's being modified by something.


--
David Precious ("bigpresh") <davidp@preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




------------------------------

_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users


End of dancer-users Digest, Vol 34, Issue 3
*******************************************