Files
2024-09-27 02:06:13 +08:00

80 lines
2.1 KiB
TypeScript

import { join } from 'path'
export default {
port: '80',
staticPath: '../public',
jwtKey: "asdg364355#$%^&%$#!@",
aliyunOssConfig: {
accessKeyId: 'LTAIXlLtUBP2Cr8F',
accessKeySecret: 'B6i0KohY3yf0YGM6xsdqrXeGgFMifs',
},
routePrefix: {
app: '/app',
admin: '/admin',
apiPrefix: {
app: {
user: "/user",
article: "/article",
link: "/link",
},
admin: {
menu: "/menu",
lib: "/lib"
}
}
},
setPrefix: function (path: string): string {
let pathArr: string[] = path.split("/");
// @ts-ignore
return `${this.routePrefix[pathArr[0]]}${this.routePrefix.apiPrefix[pathArr[0]][pathArr[1]]}`
},
orm: null,
mysql: {
type: "mysql",
host: "localhost",
port: 3306,
username: "root",
password: "",
database: "myblog",
synchronize: false,
logging: true,
entities: ["src/entity/**/*{.js,.ts}"],
},
cors: {
Origin: 'https://www.a.com',
Headers: 'token,data',
configCors: function () {
return {
"Access-Control-Allow-Origin": this.Origin,
"Access-Control-Allow-Headers": this.Headers
}
}
},
logConfig: {
appenders: {
access: {
type: 'console',
pattern: '-yyyy-MM-dd.log', //通过日期来生成文件
alwaysIncludePattern: true, //文件名始终以日期区分
encoding: "utf-8",
filename: join(__dirname, '../../logs/access.log') //生成文件路径和文件名
},
//系统日志
application: {
type: 'console',
pattern: '-yyyy-MM-dd.log', //通过日期来生成文件
alwaysIncludePattern: true, //文件名始终以日期区分
encoding: "utf-8",
filename: join(__dirname, '../../logs/application.log') //生成文件路径和文件名
},
out: {
type: 'console'
}
},
categories: {
default: { appenders: ['out'], level: 'info' },
access: { appenders: ['access'], level: 'info' },
application: { appenders: ['application'], level: 'WARN' }
}
},
}