To keep a secret secret, you can set it in an environment variable (for example, "COOKIE_SECRET"), and then you can:
var cookieSecret = process.env.COOKIE_SECRET; app.use(express.cookieParser( cookieSecret ));
(Or, if you need a more complicated configuration setting, you can take a look at nconf . It combines configuration through environment variables, command line arguments, and flat files).
source share