Skip to content

Instantly share code, notes, and snippets.

@tobie
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobie/ee909e29a4ebebf2dc1c to your computer and use it in GitHub Desktop.
Save tobie/ee909e29a4ebebf2dc1c to your computer and use it in GitHub Desktop.
var ENV_REGEXPS = {};
for (var k in process.env) {
ENV_REGEXPS["[" + k + "]"] = new RegExp(escRegExp(process.env[k]), "g");
}
// Make sure ENV VARS don't accidentally end-up in a log.
// Note this opens up the risk of ENV VARS being
// leaked if known content contains the value of ENV VARS.
var log = kue.Job.prototype.log;
kue.Job.prototype.log = function() {
var str = arguments[0];
for (var k in ENV_REGEXPS) {
str = str.replace(ENV_REGEXPS[k], k);
}
arguments[0] = str;
return log.apply(this, arguments);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment