Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.use('/blind/dust', function(req, res){
if(req.url) {
var url_parts = url.parse(req.url, true);
var inj = url_parts.query.inj;
var tpl = '';
if('tpl' in url_parts.query && url_parts.query.tpl != '') {
// Keep the formatting a-la-python
tpl = url_parts.query.tpl.replace('%s', inj);
}
else {
tpl = inj;
}
console.log('PAYLOAD: ' + tpl);
dust.debugLevel = "DEBUG"
var compiled = dust.compile(tpl, "compiled");
dust.loadSource(compiled);
dust.render("compiled", {}, function(err, outp) { })
res.end(randomstring.generate());
}
});
var util = require("../util/util");
var dust = require("dustjs-linkedin");
require("dustjs-helpers");
// we always set dust cache to false
// this is because dust cache is file path dependent (could collide across tenants)s
dust.config.cache = false;
// instead we manage our own template cache
var TEMPLATE_CACHE = {};
if (process.env.CLOUDCMS_APPSERVER_MODE === "production") {
dust.debugLevel = "INFO";
} else {
dust.debugLevel = "DEBUG";
dust.config.cache = false;
}
if (process.env.CLOUDCMS_APPSERVER_MODE !== "production") {
dust.config.whitespace = true;
}
if (process.env.DUST_DEBUG_LEVEL) {
dust.debugLevel = (process.env.DUST_DEBUG_LEVEL + "").toUpperCase();
}
/**
* Override Dust's isThenable() function so that Gitana driver chainable objects aren't included.
*
* @param elem
* @returns {*|boolean}
Dust.prototype.setDebugLevel = function (debugLevel) {
dust.debugLevel = debugLevel
}