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

'use strict';

const path = require('path')
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};
  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1642067379356_9612';

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

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  const view = {
    root: path.join(appInfo.baseDir, 'app/public'),
    defaultViewEngine: 'nunjucks',
    mapping: {
      '.html': 'nunjucks',
    }
  }

  config.cluster = {
    listen: {
      path: '',
      port: 8001,
      hostname: '0.0.0.0',
    }
  };

  config.restful = {
    tokenUrl: '/uaa/v1/auth/tokens',
    tokenMethod: 'POST',
    scope: "global_access:tenant_admin",
    // host: 'http://118.178.181.180:20000/',
    host: 'http://47.110.250.177:20000/',
    // host: 'http://47.110.158.110:20000/',
    // host:'http://120.27.220.60:20000/',
    // host: 'http://39.104.52.206:20000/',
    // host: 'http://47.99.189.12:20000/',
    ossUrl: 'http://47.110.250.177:20000/',
    version: '/v1',
    // host: '47.110.158.110',
    // host: '120.27.220.60',
    // host: '39.104.52.206', 
    port: 20000
  };

  config.static = {
    prefix: '',
    dir: path.join(appInfo.baseDir, 'app/public'),
    dynamic: true,//是否緩存靜態資源
    preload: false,//啓動項目開啓緩存
    maxAge: 0, //緩存時間 開發建議設0 跳坑
    buffer: false//是否緩存到内存 默認prod 緩存
  };

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