Skip to content

Commit 41c022f

Browse files
authored
Merge pull request #1352 from metacpan/haarg/config-in-cat
Improved configuration mechanism for testing
2 parents fa5cf62 + 38853d4 commit 41c022f

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/local/
77
/log4perl_local.conf
88
/metacpan_server_local.*
9+
/metacpan_server_testing_local.*
910
/perltidy.LOG
1011
/pm_to_blib
1112
/var

lib/MetaCPAN/Server.pm

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ use Moose;
44

55
## no critic (Modules::RequireEndWithOne)
66
use Catalyst qw( +MetaCPAN::Role::Fastly::Catalyst ), '-Log=warn,error,fatal';
7-
use Digest::SHA ();
8-
use Log::Log4perl::Catalyst ();
9-
use Plack::Builder qw( builder enable );
10-
use Ref::Util qw( is_arrayref is_hashref );
7+
use Digest::SHA ();
8+
use Log::Log4perl::Catalyst ();
9+
use Plack::Builder qw( builder enable );
10+
use Ref::Util qw( is_arrayref is_hashref );
11+
use MetaCPAN::Server::Config ();
1112

1213
extends 'Catalyst';
1314

@@ -72,9 +73,9 @@ __PACKAGE__->config(
7273

7374
__PACKAGE__->log( Log::Log4perl::Catalyst->new( undef, autoflush => 1 ) );
7475

76+
__PACKAGE__->config( MetaCPAN::Server::Config::config() );
7577
__PACKAGE__->setup( qw(
7678
Static::Simple
77-
ConfigLoader
7879
Session
7980
Session::Store::ElasticSearch
8081
Session::State::Cookie

lib/MetaCPAN/Server/Config.pm

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ sub _zomg {
2121
my $path = shift;
2222

2323
my $config = Config::ZOMG->new(
24-
local_suffix => $ENV{HARNESS_ACTIVE} ? 'testing' : 'local',
25-
name => 'metacpan_server',
26-
path => $path,
24+
name => 'metacpan_server'
25+
. ( $ENV{HARNESS_ACTIVE} ? '_testing' : '' ),
26+
path => $path,
2727
);
2828

2929
my $c = $config->open;

metacpan_server_testing.yaml

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
git: /usr/bin/git
12
cpan: var/t/tmp/fakecpan
23
die_on_error: 1
34
level: warn
@@ -8,17 +9,29 @@ elasticsearch_servers:
89
client: '2_0::Direct'
910
nodes: http://elasticsearch_test:9200
1011

12+
minion_dsn: "postgresql://metacpan:t00lchain@pghost:5432/minion_queue"
13+
1114
logger:
1215
class: Log::Log4perl::Appender::Screen
1316
name: testing
1417

15-
github_key: foo
16-
github_secret: bar
17-
1818
secret: weak
1919

2020
smtp:
2121
host: smtp.fastmail.com
2222
port: 465
2323
2424
password: seekrit
25+
26+
oauth:
27+
github:
28+
key: seekrit
29+
secret: seekrit
30+
google:
31+
key: seekrit
32+
secret: seekrit
33+
twitter:
34+
key: seekrit
35+
secret: seekrit
36+
37+
front_end_url: http://0.0.0.0:5001

0 commit comments

Comments
 (0)