Ich benutze Helmmodul mit sails.js für Content Security Policy in app/config/http.jsmit sails.config in Middle
// app/config/http.js
module.exports.http = {
order: [
...
'csp',
'router',
'www',
'favicon',
'404',
'500'
],
...
csp: require('helmet').csp({directives:{...}}),
...
}
ich das Objekt in csp() will in meiner Config sein/local.js
// config/local.js
module.exports = {
...
csp: {directives:{...}},
...
}
Aber wenn ich require('helmet').csp(sails.config.csp)
in app/config/http.js ich einen Fehler bekam:
ReferenceError: sails is not defined
Ich verstehe, warum es nicht definiert ist, aber ich weiß nicht, wie man sails.config.http abhängig von der Umgebung ändert
ich habe es. Vielen Dank – Martial