Skip to content

Commit

Permalink
Merge pull request #1845 from metacpan/leo/fix_datacenter_endpoint
Browse files Browse the repository at this point in the history
Leo/fix datacenter endpoint
  • Loading branch information
mickeyn committed Jan 19, 2017
2 parents 8878b30 + 0688b47 commit b771f9b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cpanfile
Expand Up @@ -59,7 +59,7 @@ requires 'Moo', '2.000002';
requires 'MooseX::ClassAttribute';
requires 'MooseX::Role::Parameterized', '1.02';
requires 'MooseX::StrictConstructor';
requires 'MooseX::Fastly::Role', '0.02';
requires 'MooseX::Fastly::Role', '0.03';
requires 'PerlIO::gzip';
requires 'MetaCPAN::Moose';
requires 'MetaCPAN::Role', '0.06';
Expand Down
24 changes: 8 additions & 16 deletions cpanfile.snapshot
Expand Up @@ -264,13 +264,6 @@ DISTRIBUTIONS
perl 5.006
strict 0
warnings 0
Carp-Always-0.13
pathname: F/FE/FERREIRA/Carp-Always-0.13.tar.gz
provides:
Carp::Always 0.13
requirements:
Carp 0
ExtUtils::MakeMaker 0
Carp-Assert-0.21
pathname: N/NE/NEILB/Carp-Assert-0.21.tar.gz
provides:
Expand Down Expand Up @@ -2234,7 +2227,6 @@ DISTRIBUTIONS
IO::Socket::SSL::Utils 2.014
requirements:
ExtUtils::MakeMaker 0
Mozilla::CA 0
Net::SSLeay 1.46
Scalar::Util 0
IO-String-1.08
Expand Down Expand Up @@ -2314,7 +2306,6 @@ DISTRIBUTIONS
JSON::MaybeXS 1.003005
requirements:
Carp 0
Cpanel::JSON::XS 2.3310
ExtUtils::CBuilder 0.27
ExtUtils::MakeMaker 0
File::Spec 0
Expand Down Expand Up @@ -3267,15 +3258,16 @@ DISTRIBUTIONS
Test::Exception 0
Test::More 0
namespace::clean 0
MooseX-Fastly-Role-0.02
pathname: L/LL/LLAP/MooseX-Fastly-Role-0.02.tar.gz
MooseX-Fastly-Role-0.03
pathname: L/LL/LLAP/MooseX-Fastly-Role-0.03.tar.gz
provides:
MooseX::Fastly::Role 0.02
MooseX::Fastly::Role 0.03
requirements:
Carp 0
ExtUtils::MakeMaker 0
HTTP::Tiny 0
Moose::Role 0
Net::Fastly 1.08
MooseX-Getopt-0.70
pathname: D/DR/DROLSKY/MooseX-Getopt-0.70.tar.gz
provides:
Expand Down Expand Up @@ -3646,10 +3638,10 @@ DISTRIBUTIONS
Test::More 0.52
Time::Local 1.19
perl 5.00404
Net-Fastly-1.05
pathname: F/FA/FASTLY/Net-Fastly-1.05.tar.gz
Net-Fastly-1.08
pathname: F/FA/FASTLY/Net-Fastly-1.08.tar.gz
provides:
Net::Fastly 1.05
Net::Fastly 1.08
Net::Fastly::Backend undef
Net::Fastly::BelongsToServiceAndVersion undef
Net::Fastly::Client undef
Expand Down Expand Up @@ -3680,7 +3672,7 @@ DISTRIBUTIONS
JSON::XS 0
LWP::Protocol::https 0
LWP::UserAgent 5.813
Module::Build 0.38
Module::Build::Tiny 0.034
Test::More 0
URI 0
URI::Escape 0
Expand Down
11 changes: 10 additions & 1 deletion lib/MetaCPAN/Web/Controller/SysAdmin/DataCenters.pm
Expand Up @@ -7,12 +7,21 @@ BEGIN { extends 'MetaCPAN::Web::Controller' }
# This is used by http://mirrors.cpan.org/ fetch our
# datacenters and update the official CPAN list

# /sysadmin/datacenters/list
sub list_datacenters : Path('list') : Args(0) GET {
my ( $self, $c ) = @_;

# Fetch the data center info from fastly
# XXX: will not work unless you have the credentials
my $datacenters = $c->datacenters;
my $datacenters;

if ( my $net_fastly = $c->cdn_api() ) {

# Uses the private interface as fastly client doesn't
# have this end point yet
$datacenters = $net_fastly->client->_get('/datacenters');

}

$c->add_surrogate_key('datacenters');
$c->cdn_max_age('1d');
Expand Down

0 comments on commit b771f9b

Please sign in to comment.