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

85 lines
1.8 KiB
TypeScript

import { join } from 'path'
export default {
port: '3000',
staticPath: '../public',
jwtKey: "asdg364355#$%^&%$#!@",
aliyunOssConfig: {
// LTAI5t7AMUhZoameSfCHEJrB
// wSw85GE23DJjM9lII4JosHtiObIXjT
accessKeyId: 'LTAI5t7AMUhZoameSfCHEJrB',
accessKeySecret: 'wSw85GE23DJjM9lII4JosHtiObIXjT',
},
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: "root",
database: "myblog",
synchronize: false,
logging: true,
entities: [ join(__dirname, "../entity/**/*{.js,.ts}") ],
},
cors: {
Origin: '*',
Headers: 'token',
configCors: function () {
return {
"Access-Control-Allow-Origin": this.Origin,
"Access-Control-Allow-Headers": this.Headers
}
}
},
logConfig: {
appenders: {
//系统日志
access: {
type: 'dateFile',
pattern: '_yyyy-MM-dd.log',
alwaysIncludePattern: true,
encoding: "utf-8",
category: "access",
filename: join(__dirname, '../../logs/access')
},
// 应用日志
application: {
type: 'dateFile',
pattern: '_yyyy-MM-dd.log',
alwaysIncludePattern: true,
encoding: "utf-8",
category: "application",
filename: join(__dirname, '../../logs/application')
},
out: {
type: 'console'
}
},
categories: {
default: { appenders: ['out'], level: 'info' },
access: { appenders: ['access'], level: 'info' },
application: { appenders: ['application'], level: 'WARN' }
}
},
}