Add ability to filter beta challenges from production

This PR adds the ability to test out challenges in beta
without fear that they will leak to production servers.

In development all challenges will display.

In production all challenges marked 'isBeta' will be filtered out
except in the case the environmental variable `BETA` is set ture,
in which case all challenges will display.
This commit is contained in:
Berkeley Martinez
2015-10-06 22:37:08 -07:00
parent b0ee678af8
commit 1c40fb8c19

View File

@ -43,6 +43,7 @@ Challenge.destroyAll(function(err, info) {
var challengeSpec = require('./challenges/' + file);
var order = challengeSpec.order;
var block = challengeSpec.name;
var isBeta = !!challengeSpec.isBeta;
// challenge file has no challenges...
if (challengeSpec.challenges.length === 0) {
@ -66,6 +67,7 @@ Challenge.destroyAll(function(err, info) {
challenge.order = order;
challenge.suborder = index + 1;
challenge.block = block;
challenge.isBeta = challenge.isBeta || isBeta;
return challenge;
});