Skip to content

Commit 38853d4

Browse files
committed
allow local testing config
It can be useful to modify the testing config, such as to point to an alternate Elasticsearch server. When loading the testing config using a modified config suffix, it will merge the data with the main config. But this also prevents loading a local testing config. Instead, we can use a custom config file name, and still allow a _local suffix. Copy the extra config options from the main config to the test config, since it will no longer be merging them.
1 parent 2bac1f1 commit 38853d4

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

Diff for: .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

Diff for: 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;

Diff for: 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)