From 1c40fb8c19f6468c088c3563f8afdf120e950b0d Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 6 Oct 2015 22:37:08 -0700 Subject: [PATCH] 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. --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 334a11d3dc..bd05f2de96 100644 --- a/index.js +++ b/index.js @@ -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; });