up
This commit is contained in:
@@ -1 +1,4 @@
|
||||
/*应用配置*/
|
||||
module.exports = {
|
||||
port: 3000,
|
||||
}
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
keys: '',
|
||||
listen: {
|
||||
port: 32006,
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
// 配置需要的中间件,数组顺序即为中间件的加载顺序
|
||||
middleware: ['jiujianJwt'],
|
||||
mysql: {
|
||||
host: '192.168.1.25',
|
||||
port: 3306,
|
||||
username: 'shichu',
|
||||
password: 'zXbAhBA26anGGEhY',
|
||||
},
|
||||
mongo: {},
|
||||
redis: {
|
||||
path: '',
|
||||
port: 32005,
|
||||
hostname: '0.0.0.0',
|
||||
},
|
||||
sequelize: {},
|
||||
/** 关闭csrf,否则api post将无法访问 */
|
||||
csrf: false,
|
||||
jwt: {
|
||||
secret: "_shichu",//自定义 token 的加密条件字符串
|
||||
expiresIn: "30d",//表示有效期 不带单位默认为秒 如带单位如: "2 days", "10h", "7d"
|
||||
},
|
||||
/** cors 允许跨域 */
|
||||
cors: {
|
||||
origin: '*',
|
||||
credentials: true,
|
||||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
|
||||
},
|
||||
/** multipart 文件上传 */
|
||||
multipart: {
|
||||
whitelist: [// 文件白名单
|
||||
// images
|
||||
'.jpg', '.jpeg', // image/jpeg
|
||||
'.png', // image/png, image/x-png
|
||||
// '.gif', // image/gif
|
||||
// '.bmp', // image/bmp
|
||||
// '.wbmp', // image/vnd.wap.wbmp
|
||||
// '.webp',
|
||||
// '.tif',
|
||||
// '.psd',
|
||||
// // text
|
||||
// '.svg',
|
||||
// '.js', '.jsx',
|
||||
// '.json',
|
||||
// '.css', '.less',
|
||||
// '.html', '.htm',
|
||||
// '.xml',
|
||||
// // tar
|
||||
// '.zip',
|
||||
// '.gz', '.tgz', '.gzip',
|
||||
// // video
|
||||
// '.mp3',
|
||||
// '.mp4',
|
||||
// '.avi',
|
||||
'.p12',
|
||||
],
|
||||
},
|
||||
axios: {
|
||||
// can set more config in headers,like token,references and so on
|
||||
headers: {
|
||||
common: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
// 添加认证【例如】,也可以在请求拦截器中修改具体的request config
|
||||
// 'Authorization':'19980115_520' // 不要问我19980115是什么,当然是女朋友生日呀!!!
|
||||
},
|
||||
// 可以设置请求头等属性
|
||||
},
|
||||
// 定义请求拦截器处理方法【可选】
|
||||
// requestInterceptorsHandler: config => {
|
||||
// console.log('定义请求拦截器处理方法',config);
|
||||
// 请求之前的配置信息
|
||||
// 当该字段【函数】不存在是,默认如下:
|
||||
// app.coreLogger.debug(`[egg-axios-plus] send request, baseURL: ${JSON.stringify(baseURL)}, url: ${url}, method: ${method}, data: ${JSON.stringify(data)}, headers: ${JSON.stringify(headers)}`);
|
||||
// return config;
|
||||
// },
|
||||
// requestInterceptorsErrorHandler: error => {
|
||||
// // 请求之后发生的错误信息
|
||||
// // 当该字段【函数】不存在是,默认如下:
|
||||
// app.coreLogger.error(`[egg-axios-plus] send request error, ${error.message}`);
|
||||
// return Promise.reject(error);
|
||||
// },
|
||||
// // 定义axios响应拦截器处理方法【可选】
|
||||
// responseInterceptorsHandler: response => {
|
||||
// // response 响应结果
|
||||
// // 当该字段【函数】不存在是,默认如下:
|
||||
// app.coreLogger.debug(`[egg-axios-plus] receive response, data: ${JSON.stringify(response.data)}, status: ${response.status}, headers: ${JSON.stringify(response.headers)}`);
|
||||
// if (response.config && (response.method.toUpperCase() === 'HEAD' || response.method.toUpperCase() === 'options')) {
|
||||
// return response;
|
||||
// }
|
||||
// return response.data;
|
||||
// },
|
||||
responseInterceptorsErrorHandler: error => {
|
||||
// 接口响应失败的错误结果
|
||||
// 当该字段【函数】不存在是,默认如下:
|
||||
// app.coreLogger.error(`[egg-axios-plus] receive response error, ${error.message}`);
|
||||
console.log(`[egg-axios-plus] receive response error, ${error.message}`);
|
||||
return Promise.reject(error);
|
||||
},
|
||||
timeout: 12000, // 默认请求超时
|
||||
app: true, // 在app.js上启动加载
|
||||
agent: false, // 在agent.js上启动加载
|
||||
}
|
||||
};
|
||||
@@ -1 +1,35 @@
|
||||
/*日志配置*/
|
||||
'use strict';
|
||||
module.exports = {
|
||||
replaceConsole: true,
|
||||
pm2 : true,
|
||||
appenders : {
|
||||
stdout: {//控制台输出
|
||||
type: 'console'
|
||||
},
|
||||
req : { //请求转发日志
|
||||
type : 'dateFile', //指定日志文件按时间打印
|
||||
filename : 'logs/req/req', //指定输出文件路径
|
||||
pattern : 'yyyy-MM-dd.log',
|
||||
alwaysIncludePattern: true
|
||||
},
|
||||
err : { //错误日志
|
||||
type : 'dateFile',
|
||||
filename : 'logs/err/err',
|
||||
pattern : 'yyyy-MM-dd.log',
|
||||
alwaysIncludePattern: true
|
||||
},
|
||||
oth : { //其他日志
|
||||
type : 'dateFile',
|
||||
filename : 'logs/oth/oth',
|
||||
pattern : 'yyyy-MM-dd.log',
|
||||
alwaysIncludePattern: true
|
||||
}
|
||||
|
||||
},
|
||||
categories : {
|
||||
//appenders:采用的appender,取appenders项,level:设置级别
|
||||
default: {appenders: ['stdout', 'req'], level: 'debug'},
|
||||
err : {appenders: ['stdout', 'err'], level: 'error'},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
'use strict';
|
||||
import path from 'path';
|
||||
import bodyParser from 'koa-bodyparser';
|
||||
import staticFile from 'koa-static';
|
||||
export default {
|
||||
bodyParser: bodyParser(),
|
||||
staticFile: staticFile(path.resolve('pbulic')),
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
time: {
|
||||
params: '123'
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/*redis配置*/
|
||||
module.exports = {
|
||||
port: 3000,
|
||||
}
|
||||
Reference in New Issue
Block a user