Commit 7bce5521 authored by HAYWAEL's avatar HAYWAEL

fix

parent e7bc741b
Pipeline #27909 passed with stage
in 2 minutes 38 seconds
export interface ConfigProdState {
debug?: boolean;
sessionExpireIn?: number;
logger?: any;
export interface ConfigDefaultState {
multipart?: { fileExtensions: string[]; fileSize: string; };
projectRootPath?: string;
keys?: string;
middleware?: any;
jwtMiddle?: { exclude: string[]; };
jwt?: any;
sequelize?: any;
redis?: any;
security?: any;
cors?: any;
DD_CONFIG?: any;
oss?: any;
onerror?: any;
mailer?: any;
SERVICE_HOST?: string;
runEnv?: string;
proxy?: any;
}
export default () => {
const config: ConfigProdState = {};
export default (appInfo: { name: string; }) => {
const config: ConfigDefaultState = {};
config.debug = true;
config.multipart = {
fileExtensions: [
'.xlsx',
'.xls',
],
fileSize: '100mb',
};
config.projectRootPath = '/api';
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1537508791174_5973';
config.sessionExpireIn = 60 * 60 * 24 * 7;
// add your config here
config.middleware = [
'errorHandler',
'pagination',
'jwtMiddle',
];
config.logger = {
dir: '/jianbing/logs/zeus-server',
config.jwtMiddle = {
exclude: [
'/api/login',
],
};
config.jwt = {
secret: process.env.JWT_SECRET,
exp: Math.floor(Date.now() / 1000) + config.sessionExpireIn,
enable: true, // default is false
credentialsRequired: false,
match: '*', // optional
secret: '123456',
};
config.sequelize = {
datasources: [{
// 东八时区
timezone: '+08:00',
delegate: 'wafangModel',
baseDir: 'model/wafang',
dialect: 'mysql',
host: 'rm-wafang-rds-pubilc.mysql.rds.aliyuncs.com',
database: 'wafang_dev',
username: 'wafang_test',
password: 'ztQ4Y8piePY3521gx74Ii',
port: 3306,
}],
// 是否启用csrf安全
config.security = {
csrf: {
enable: false,
},
domainWhiteList: [],
};
config.mailer = {
client: {
host: 'smtp.exmail.qq.com',
port: 465,
user: 'report@jianbing.com',
pass: 'AAbb1234',
sender: '煎饼网络数据中心',
config.cors = {
origin: '*',
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
credentials: true,
};
config.DD_CONFIG = {
corpId: 'dingbd41a9a5fb105629', // 公司唯一标识
secret: '5gz8ZKXwNWqiIjUeemVI1Zxnw7s6PJx6KJLOpabexuZhCSYREloULpNMUlWGJEQm', // 认证密钥,非常重要,妥善保管,具有极高权限
token: 'dsrtiw', // 加解密时有用到
aesKey: '1234567890123456789012345678901234567890123', // 加解密时有用到
agentId: {
// 微应用的ID
default: '116146340',
},
nonceStr: 'gjjj51', // aes加解密及签名时用到, len=6
sso: {
appId: 'dingoameqb6kx8gwcg50wi', // 钉钉扫码登陆的 appId
appSecret: 'aCep7Y_Tr5x6ISr-UTML88pBN5KBqzhxSJ9FwA-emTq_GJaWZCRA-P1thcd2K-0E', // 钉钉扫码登陆的 appSecret
},
};
config.SERVICE_HOST = process.env.SERVICE_HOST;
config.oss = {
clients: {
default: {
accessKeyId: 'LTAIRRW7SbrqKUIJ',
accessKeySecret: 'AC15o0PrchUiK1xlZx7DhF5Bmumt7K',
bucket: 'nodeadmin',
endpoint: 'oss-cn-hangzhou.aliyuncs.com',
timeout: '60s',
},
media: {
accessKeyId: 'LTAIA1esjBRaabT9',
accessKeySecret: '2Bf7tp5Dkr657ZzUv1bfwbEgl1zQT4',
bucket: '51shequ',
endpoint: 'oss-cn-hangzhou.aliyuncs.com',
timeout: '60s',
},
},
};
config.runEnv = process.env.runEnv || 'pro';
config.onerror = {
appErrorFilter: err => {
if (err.status && Math.floor(err.status / 100) === 4) {
return false;
}
return true;
},
};
config.proxy = {
match: /(\/api\/yizhi\/)/, // path pattern.
proxyList: [{
match: /(\/api\/yizhi\/)/,
host: config.SERVICE_HOST, // target host that matched path will be proxy to
map(path) { return path.replace(/(\/api\/yizhi)/, '/yizhi_server/api'); }, // 预处理路径
suppressRequestHeaders: [], // 不需要转发的请求头
}],
config.mailer = {
client: {
host: 'smtp.exmail.qq.com',
port: 465,
user: 'report@jianbing.com', // generated ethereal user
pass: 'AAbb1234', // generated ethereal password
sender: '煎饼网络数据中心--测试',
},
};
return config;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment