diff --git a/config/custom-environment-variables.json.example b/config/custom-environment-variables.json.example index 8b4fb90..edf67a2 100644 --- a/config/custom-environment-variables.json.example +++ b/config/custom-environment-variables.json.example @@ -4,6 +4,8 @@ "POTC_BASE_URL": "POTC_BASE_URL" }, + "MAINTENANCE_MODE": "MAINTENANCE_MODE", + "CREDENTIALS": { "POTC": { "DEBUG_KEY": "POTC_DEBUG_KEY" diff --git a/config/default.json b/config/default.json index 1e4f6b3..e0cf213 100644 --- a/config/default.json +++ b/config/default.json @@ -11,6 +11,8 @@ "maxAge": 0 }, + "MAINTENANCE_MODE": false, + "API": { "POTC_BASE_URL": "https://congressforms.eff.org", "SMARTY_STREETS": { diff --git a/server/routes/app/home.js b/server/routes/app/home.js index 3fba88a..e55e094 100644 --- a/server/routes/app/home.js +++ b/server/routes/app/home.js @@ -3,7 +3,14 @@ */ var home = function(req, res) { - res.render('index'); + var maintenanceMode = req.app.locals.CONFIG.get('MAINTENANCE_MODE'); + if (maintenanceMode == 'false') + maintenanceMode = false; + + if (maintenanceMode && !req.query.maintenance) + res.render('maintenance'); + else + res.render('index'); }; diff --git a/server/templates/maintenance.dust b/server/templates/maintenance.dust new file mode 100644 index 0000000..82b486e --- /dev/null +++ b/server/templates/maintenance.dust @@ -0,0 +1,24 @@ +{>"layouts/master" /} + +{
+ +