File tree Expand file tree Collapse file tree 7 files changed +26
-11
lines changed
Catalyst/Plugin/Session/Store Expand file tree Collapse file tree 7 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ use Moose;
6
6
extends ' Catalyst::Plugin::Session::Store' ;
7
7
use MooseX::Types::ElasticSearch qw( :all) ;
8
8
9
+ use MetaCPAN::Config ();
10
+
9
11
has _session_es => (
10
12
required => 1,
11
13
is => ' ro' ,
12
14
coerce => 1,
13
15
isa => ES,
14
- default => sub { shift -> _session_plugin_config -> { servers } || ' :9200 ' }
16
+ default => sub { MetaCPAN::Config::config() -> { elasticsearch_servers } },
15
17
);
16
18
has _session_es_index => (
17
19
required => 1,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use DateTime::Format::ISO8601 ();
9
9
use DDP;
10
10
use HTTP::Tiny ();
11
11
use Log::Contextual qw( :log ) ;
12
+ use MetaCPAN::Config ();
12
13
use MetaCPAN::Types::TypeTiny qw( ArrayRef Bool Str ) ;
13
14
use Moose;
14
15
use Sys::Hostname qw( hostname ) ;
@@ -80,9 +81,9 @@ has snap_name => (
80
81
);
81
82
82
83
has host => (
83
- is => ' ro' ,
84
- isa => Str,
85
- default => ' http://localhost:9200 ' ,
84
+ is => ' ro' ,
85
+ isa => Str,
86
+ default => sub { MetaCPAN::Config::config() -> { elasticsearch_servers } } ,
86
87
documentation => ' ES host, defaults to: http://localhost:9200' ,
87
88
);
88
89
Original file line number Diff line number Diff line change 1
1
package MetaCPAN::Server::Model::CPAN ;
2
2
3
- use strict;
4
- use warnings;
5
-
6
- use MetaCPAN::Model ();
7
3
use Moose;
8
4
5
+ use MetaCPAN::Config ();
6
+ use MetaCPAN::Model ();
7
+
9
8
extends ' Catalyst::Model' ;
10
9
11
10
has esx_model => (
@@ -22,7 +21,9 @@ has index => (
22
21
23
22
has servers => (
24
23
is => ' ro' ,
25
- default => ' :9200' ,
24
+ default => sub {
25
+ return MetaCPAN::Config::config()-> {elasticsearch_servers };
26
+ },
26
27
);
27
28
28
29
sub _build_esx_model {
Original file line number Diff line number Diff line change 1
1
git /usr/bin/git
2
2
3
+ elasticsearch_servers = :9200
3
4
minion_dsn = postgresql:///minion_queue
4
5
5
6
<controller User::Turing>
Original file line number Diff line number Diff line change 1
1
cpan var/t/tmp/fakecpan
2
2
source_base var/t/tmp/source
3
3
4
+ elasticsearch_servers = http://elasticsearch_test:9200
5
+
4
6
<model CPAN>
5
7
servers __ENV(ES)__
6
8
</model CPAN>
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use strict;
4
4
use warnings;
5
5
6
6
use HTTP::Request::Common qw( POST GET DELETE) ;
7
+ use MetaCPAN::Config ();
7
8
use MetaCPAN::Server ();
8
9
use Plack::Test;
9
10
use Test::More;
@@ -40,7 +41,12 @@ sub app {
40
41
require MetaCPAN::Model;
41
42
42
43
sub model {
43
- MetaCPAN::Model-> new( es => ( $ENV {ES_TEST } ||= ' localhost:9200' ) );
44
+ MetaCPAN::Model-> new(
45
+ es => (
46
+ $ENV {ES_TEST }
47
+ ||= MetaCPAN::Config::config()-> {elasticsearch_servers }
48
+ )
49
+ );
44
50
}
45
51
46
52
1;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package MetaCPAN::TestServer;
2
2
3
3
use MetaCPAN::Moose;
4
4
5
+ use MetaCPAN::Config ();
5
6
use MetaCPAN::DarkPAN ();
6
7
use MetaCPAN::Script::Author ();
7
8
use MetaCPAN::Script::Cover ();
@@ -82,7 +83,8 @@ sub _build_config {
82
83
sub _build_es_home {
83
84
my $self = shift ;
84
85
85
- my $es_home = $ENV {ES_TEST };
86
+ my $es_home = $ENV {ES_TEST }
87
+ || MetaCPAN::Config::config()-> {elasticsearch_servers };
86
88
87
89
if ( !$es_home ) {
88
90
my $es_home = $ENV {ES_HOME } or die <<'USAGE' ;
You can’t perform that action at this time.
0 commit comments