Skip to content

Commit

Permalink
WIP: use config for links where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Jun 10, 2016
1 parent 2071c8d commit 0586df1
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 20 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -28,8 +28,6 @@ optional and not required to hack on the front-end. The address to the API
user can be changed in the `metacpan_web.conf` file. Ideally you would create a
new file called `metacpan_web_local.conf` that contains

api http://127.0.0.1:5000
api_external http://127.0.0.1:5000
api_secure http://127.0.0.1:5000
api_external_secure http://127.0.0.1:5000

Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Sitemap.pm
Expand Up @@ -58,7 +58,7 @@ sub process {
# XXX Remove this hardcoded URL
my $es = Search::Elasticsearch->new(
cxn_pool => 'Static::NoPing',
nodes => ['api.metacpan.org'],
nodes => ['api-v1.metacpan.org'],
send_get_body_as => 'POST',
);

Expand Down
14 changes: 6 additions & 8 deletions lib/MetaCPAN/Web/Controller/Root.pm
Expand Up @@ -99,14 +99,12 @@ sub end : ActionClass('RenderView') {
if ( $ENV{PLACK_ENV} && $ENV{PLACK_ENV} eq 'development' ) {
$c->stash->{PLACK_ENV} = 'development';
}
$c->stash->{req} = $c->req;
$c->stash->{api} = $c->config->{api};
$c->stash->{api_secure} = $c->config->{api_secure} || $c->config->{api};
$c->stash->{api_external}
= $c->config->{api_external} || $c->config->{api};
$c->stash->{api_external_secure}
= $c->config->{api_external_secure}
|| $c->config->{api_external}
$c->stash->{req} = $c->req;
$c->stash->{web_secure} = $c->config->{web_secure};
$c->stash->{mcpan_web} = $c->config->{mcpan_web};
$c->stash->{mcpan_api} = $c->config->{mcpan_api};
$c->stash->{api_secure} = $c->config->{api_secure};
$c->stash->{api_external_secure} = $c->config->{api_external_secure}
|| $c->stash->{api_secure};
$c->stash->{oauth_prefix}
= $c->stash->{api_external_secure}
Expand Down
3 changes: 3 additions & 0 deletions metacpan_web.conf
Expand Up @@ -3,6 +3,9 @@
name MetaCPAN::Web
default_view HTML

mcpan_web = v1.metacpan.org
mcpan_api = api-v1.metacpan.org
web_secure = https://v1.metacpan.org
api_secure = https://api-v1.metacpan.org
api_external_secure = https://api-v1.metacpan.org
consumer_key = metacpan.dev
Expand Down
8 changes: 4 additions & 4 deletions root/about.html
Expand Up @@ -18,12 +18,12 @@

MetaCPAN has two parts:

* [metacpan.org](https://metacpan.org), a front end to...
* [api-v1.metacpan.org](http://api-v1.metacpan.org/) the API
* [<% mcpan_web %>](<% web_secure %>), a front end to...
* [<% mcpan_api %>](<% api_secure %>) the API

So
[https://metacpan.org/module/Moose](https://metacpan.org/module/Moose)
vs [http://api-v1.metacpan.org/module/Moose](http://api-v1.metacpan.org/module/Moose)
[<% web_secure %>/module/Moose](<% web_secure %>/module/Moose)
vs [<% api_secure %>/module/Moose](<% api_secure %>/module/Moose)

MetaCPAN is [a community effort](/about/contributors), with all the code freely
available on GitHub ([www](https://github.com/CPAN-API/metacpan-web),
Expand Down
2 changes: 1 addition & 1 deletion root/about/sponsors.html
Expand Up @@ -177,7 +177,7 @@
<p>MetaCPAN.org (the search site) probably would not exist
if it weren't for Google. This site was originally built
as a layer on top of the MetaCPAN API by <a
href="https://metacpan.org/author/PERLER">Moritz Onken</a>
href="<% web_secure %>/author/PERLER">Moritz Onken</a>
as part of his Google Summer of Code (GSoC) project. In
2014 GSoC also sponsored Talina Shrotriya's work on
MetaCPAN. We're not actually sure if we're allowed to use
Expand Down
2 changes: 1 addition & 1 deletion root/author.html
Expand Up @@ -87,7 +87,7 @@
<a class="FlattrButton" style="display:none;"
title="<% author.name %> (<% author.pauseid %>) on MetaCPAN"
rev="flattr;uid:<% donate.id %>;button:compact;category:software;tags:perl,cpan,metacpan;"
href="https://metacpan.org/author/<% author.pauseid %>"
href="<% web_secure %>/author/<% author.pauseid %>"
language="en_GB" >
<% author.name %> is <% author.pauseid %> on CPAN, the Comprehensive Perl Archive Network.
</a>
Expand Down
2 changes: 1 addition & 1 deletion root/inc/module-install.html
Expand Up @@ -10,7 +10,7 @@ <h4 class="modal-title">Module Install Instructions</h4>
<p><a href="/pod/distribution/App-cpanminus/bin/cpanm">cpanm</a></p>
<pre>
cpanm <% module.documentation or module.module.0.name or release.main_module or (release.author _ "/" _ release.archive) %></pre>
<p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
<p><a href="<% web_secure %>/pod/CPAN">CPAN shell</a></p>
<pre>
perl -MCPAN -e shell
install <% module.documentation or module.module.0.name or release.main_module or (release.author _ "/" _ release.archive) %></pre>
Expand Down
4 changes: 2 additions & 2 deletions root/wrapper.html
Expand Up @@ -39,14 +39,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><% IF title; title; ELSE; 'Search the CPAN'; END %> - metacpan.org</title>
<%- IF rss %>
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://metacpan.org/feed/<% rss %>" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="<% web_secure %>/feed/<% rss %>" />
<%- END %>
<%- FOREACH css IN req.env.item('psgix.assets').grep(/\.css$/) %>
<link href="<% css %>" rel="stylesheet" type="text/css">
<%- END %>
<link rel="search" href="/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
<%- IF canonical %>
<link rel="canonical" href="https://metacpan.org<% canonical %>" />
<link rel="canonical" href="<% web_secure %><% canonical %>" />
<%- END %>
<%- IF meta_description %>
<meta name="description" content="<% meta_description %>" />
Expand Down

0 comments on commit 0586df1

Please sign in to comment.