Conditionally purge on deploys

We can configure this within Travis
This commit is contained in:
Ray Schamp 2017-12-01 15:33:59 -05:00
parent ec507b73c5
commit 51d980cfb3

View file

@ -177,10 +177,12 @@ async.auto({
fastly.activateVersion(results.version, function (err, response) { fastly.activateVersion(results.version, function (err, response) {
if (err) throw new Error(err); if (err) throw new Error(err);
process.stdout.write('Successfully configured and activated version ' + response.number + '\n'); process.stdout.write('Successfully configured and activated version ' + response.number + '\n');
fastly.purgeAll(FASTLY_SERVICE_ID, function (err) { if (process.env.FASTLY_PURGE_ALL) {
if (err) throw new Error(err); fastly.purgeAll(FASTLY_SERVICE_ID, function (err) {
process.stdout.write('Purged all.\n'); if (err) throw new Error(err);
}); process.stdout.write('Purged all.\n');
});
}
}); });
} }
} }