Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1755 from metacpan/leo/fastly_datacenters
Add datacenters end point to sort out mirrors.cpan.org
- Loading branch information
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package MetaCPAN::Web::Controller::SysAdmin::DataCenters; | ||
|
||
use MetaCPAN::Moose; | ||
|
||
BEGIN { extends 'MetaCPAN::Web::Controller' } | ||
|
||
# This is used by http://mirrors.cpan.org/ fetch our | ||
# datacenters and update the official CPAN 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; | ||
|
||
$c->add_surrogate_key('datacenters'); | ||
$c->cdn_cache_ttl( $c->cdn_times->{one_day} ); | ||
$c->res->header( | ||
'Cache-Control' => 'max-age=' . $c->cdn_times->{one_day} ); | ||
$c->stash( { success => $datacenters } ); | ||
$c->detach( $c->view('JSON') ); | ||
} | ||
|
||
__PACKAGE__->meta->make_immutable; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters