Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add datacenters for mirrors.cpan.org to use
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package MetaCPAN::Web::Controller::Sysadmin::Datacenters; | ||
|
||
use 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