config.default.js 2.88 KB
/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  config.cluster = {
    listen: {
      port: 7009,
    },
  };

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1644800905769_2309';

  // add your middleware config here
  config.middleware = [];

  config.security = {
    csrf: {
      enable: false,
      ignoreJSON: true,
    },
  };

  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
  };

  // config.sequelize = {
  //   host: 'localhost',
  //   port: '5432',
  //   username: 'postgres',
  //   password: 'wawjr1314',
  //   database: 'ddn',
  //   dialect: 'postgres',
  //   pool: {
  //     max: 5,
  //     min: 0,
  //     idle: 10000,
  //   },
  //   logging: false,
  // };
  config.sequelize = {
    // In a real app, you should keep the database connection URL as an environment variable.
    // But for this example, we will just use a local SQLite database.
    // const sequelize = new Sequelize(process.env.DB_CONNECTION_URL);
    dialect: 'sqlite',
    storage: './database/ddn-wallet-test.db',
    logQueryParameters: true,
    benchmark: true,
    logging: false,

    // Specify options, which are used when sequelize.define is called.
    // The following example:
    //   define: { timestamps: false }
    // is basically the same as:
    //   Model.init(attributes, { timestamps: false });
    //   sequelize.define(name, attributes, { timestamps: false });
    // so defining the timestamps for each model will be not necessary
    define: {
      underscored: true, // 该选项在 egg-sequelize 里是默认选项
      // freezeTableName: false,
      // charset: 'utf8',
      // dialectOptions: {
      //   collate: 'utf8_general_ci'
      // },
      timestamps: true,
    },

    // similar for sync: you can define this to always force sync for models
    // sync: { force: true },

    // pool configuration used to pool database connections
    pool: {
      max: 5,
      idle: 30000,
      acquire: 60000,
    },
  };
  // config.ed25519Address = 'DFy6P2sN1KLDNtppnqLBPWcnH8GTJRouGj'; // 旧网接收钱包地址 弃用
  // config.naclSecret = 'puzzle elite rescue gun blush top floor surge injury popular pole inquiry';  // 新网转账钱包秘钥
  // // config.ed25519Url = 'http://120.24.69.99:8001'; // 旧网节点地址 弃用
  // config.naclUrl = 'http://8.142.20.158:8001'; // 新网节点地址
  // // config.naclUrl = 'http://localhost:8001'; // 测试地址
  // config.ed25519NetHash = 'b11fa2f2';// 旧网nethash
  // config.naclNetHash = '0ab796cd'; // 新网nethash
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};