【问题标题】:node js development production configurationsnode js开发生产配置
【发布时间】:2017-06-30 12:25:57
【问题描述】:

我们如何在 node js/sails 中创建不同的开发和生产配置?

另外,管理测试和生产以及后期生产之间的迁移的最佳方法是什么?

【问题讨论】:

标签: node.js sails.js


【解决方案1】:

使用config/env 文件适当地覆盖您的配置。示例生产文件:

module.exports = {

  /***************************************************************************
   * Set the default database connection for models in the production        *
   * environment (see config/connections.js and config/models.js )           *
   ***************************************************************************/

   models: {
     connection: 'someMysqlServer'
  },

  /***************************************************************************
   * Set the port in the production environment to 80                        *
   ***************************************************************************/

  port: 80,

  /***************************************************************************
   * Set the log level in production environment to "silent"                 *
   ***************************************************************************/

  log: {
    level: "silent"
  }

};

你也可以在那里定义一个test.js文件。

您为什么要从测试环境迁移到生产环境?这对我来说听起来不对。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-17
    • 2015-01-04
    • 2017-08-18
    • 2016-01-19
    • 2012-09-11
    • 1970-01-01
    • 2020-02-25
    相关资源
    最近更新 更多