在Kraken或节点中禁用会话

时间:2014-07-14 19:37:50

标签: javascript node.js kraken.js

当NODE_ENV =生产时,我需要删除Kraken.js项目中的Sessions:

Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.

这是我的Index.js文件。

'use strict';


var kraken = require('kraken-js'),
    app = require('express')(),
    options = require('./lib/spec')(app),
    port = process.env.PORT || 8000;


app.use(kraken(options));


app.listen(port, function (err) {
    console.log('[%s] Listening on http://localhost:%d', app.settings.env, port);
});

这是配置我所有prod选项的production.json。这是从development.json

重复的
"middleware": {
        "devtools": {
            "enabled": true,
            "priority": 35,
            "module": {
                "name": "kraken-devtools",
                "arguments": [
                    "path:./public",
                    "path:./.build",
                    {   
                        "template": {
                            "module": "kraken-devtools/plugins/dustjs",
                            "files": "/templates/**/*.js",
                            "base": "templates",
                            "i18n": "config:i18n"
                        },
                        "css": {
                            "module": "kraken-devtools/plugins/less",
                            "files": "/css/**/*.css"
                        },
                        "copier": {
                            "module": "kraken-devtools/plugins/copier",
                            "files": "**/*"
                        }
                    }
                ]
            }
        }
    }

1 个答案:

答案 0 :(得分:0)

试试这个:

"middleware": {
  "session": {
    "enabled": false
  },
  "devtools": {
        "enabled": true,
        "priority": 35,
        "module": {
            "name": "kraken-devtools",
            "arguments": [
                "path:./public",
                "path:./.build",
                {   
                    "template": {
                        "module": "kraken-devtools/plugins/dustjs",
                        "files": "/templates/**/*.js",
                        "base": "templates",
                        "i18n": "config:i18n"
                    },
                    "css": {
                        "module": "kraken-devtools/plugins/less",
                        "files": "/css/**/*.css"
                    },
                    "copier": {
                        "module": "kraken-devtools/plugins/copier",
                        "files": "**/*"
                    }
                }
            ]
        }
    }
}