Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
Allow site-templates.js and templates.js to be requested on ephemeral…
Browse files Browse the repository at this point in the history
… instances but not on stage or prod.
  • Loading branch information
Shane Tomlinson committed Sep 25, 2012
1 parent cd5906d commit 0dd42fc
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/static/views.js
Expand Up @@ -235,15 +235,8 @@ exports.setup = function(app) {
app.get('/i18n_fallback_test', function(req, res) {
renderCachableView(req, res, path.join(testPath, 'i18n_fallback_test.ejs'), { layout: false, title: 'l10n testing title' });
});
} else {
// this is stage or production, explicitly disable all resources under /test
app.get(/^\/test/, function(req, res) {
httputils.notFound(res, "Cannot " + req.method + " " + req.url);
});
}

// /common/js/templates.js is dynamically built each time
if (!config.get('use_minified_resources')) {
// /common/js/templates.js is dynamically built each time
var templates = require('../templates');
var dialogTemplatesPath = path.join(__dirname, '../../resources/static/dialog/views')
app.get('/common/js/templates.js', function(req, res) {
Expand All @@ -259,6 +252,12 @@ exports.setup = function(app) {
siteTemplates += templates.generate(sitePartialTemplatesPath, "partial/");
res.send(siteTemplates);
});

} else {
// this is stage or production, explicitly disable all resources under /test
app.get(/^\/test/, function(req, res) {
httputils.notFound(res, "Cannot " + req.method + " " + req.url);
});
}

// REDIRECTS
Expand Down

0 comments on commit 0dd42fc

Please sign in to comment.