oms/config/config.default.js

74 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
const db = require('../database/config').development;
/**
* @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 + '_1720000000000_1234';
// add your middleware config here
config.middleware = [];
// close csrf for easy debugging, please enable it in production if needed
config.security = {
csrf: {
enable: false,
},
};
// sequelize / mysql config,与 sequelize-cli 迁移共用 database/config.js
config.sequelize = {
...db,
define: {
underscored: true,
charset: 'utf8mb4',
dialectOptions: {
collate: 'utf8mb4_unicode_ci',
},
},
pool: {
max: 10,
min: 0,
idle: 10000,
},
};
// swagger 文档:UI 访问 /swagger-ui.html,JSON 访问 /swagger-doc
config.swaggerdoc = {
dirScanner: './app/controller',
basePath: '/',
apiInfo: {
title: 'OMS API',
description: 'OMS 后端接口文档',
version: '1.0.0',
},
schemes: [ 'http', 'https' ],
consumes: [ 'application/json' ],
produces: [ 'application/json' ],
securityDefinitions: {
apikey: {
type: 'apiKey',
name: 'Authorization',
in: 'header',
},
},
enableSecurity: false,
routerMap: false,
// 生产环境关闭文档
enable: appInfo.env !== 'prod',
};
return {
...config,
};
};