| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 | 'use strict';const path = require('path');const fs = require('fs');module.exports = appInfo => {    const config = {};    // 数据库配置    config.mysql = {        client: {            // host            host: 'rm-wz9ae9t6qopwrday6.mysql.rds.aliyuncs.com',            // 端口号            port: '3306',            // 用户名            user: 'zh_calc',            // 密码            password: 'Zh@)!(3850Calc',            // 数据库名            database: 'calculation',            // 设置mysql连接字符集            charset: 'utf8mb4',        },        // 是否加载到 app 上,默认开启        app: true,        // 是否加载到 agent 上,默认关闭        agent: false,    };    // 表名前缀    config.tablePrefix = 'zh_';    // redis设置    config.redis = {        client: {            host: '127.0.0.1',            port: '6379',            password: 'zh@)!(3850sc',            db: '0',        },        agent: true,        version: '1.0.0',    };    // should change to your own    config.keys = appInfo.name + '_1503910434503_882';    // view相关    config.view = {        mapping: {            '.ejs': 'ejs',        },        root: [            path.join(appInfo.baseDir, 'app/view'),        ].join(','),        cache: false,    };    config.static = {        maxAge: 0,        buffer: false,    };    // 分页相关    config.pageSize = 15;    // 中间件    config.middleware = ['gzip', 'urlParse', 'sortFilter', 'autoLogger', 'autoFinishLogger'];    // session配置    config.session = {        key: 'ZHC_SESS',        maxAge: 3600 * 1000 * 24, // 1小时        httpOnly: true,        encrypt: true,        rolling: true, // 每次都更新session有效期    };    // session使用redis    exports.sessionRedis = {        name: 'session',    };    // 缓存时间    config.cacheTime = 3600 * 24 * 31; // 31天 计量一期的时间,估计为1月    // 安全性配置    config.security = {        csrf: {            ignoreJSON: false, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求            ignore: '/wx', // 不进行安全校验,微信调用            cookieName: 'csrfToken_j',    // csrf token's cookie name            sessionName: 'csrfToken_j',   // csrf token's session name            bodyName: '_csrf_j',          // request csrf token's name in body            queryName: '_csrf_j',         // request csrf token's name in query        },    };    // 发送短信相关    config.sms = {        // account: '710030',        // password: 'w7pRhJ',        // extno: '10690587',        authKey: 'fb5ef483e44b9556512a9febef376051',    };    // geetest验证码key    config.geetest = {        id: '23c50f6711966f744c93a70167c8e0a4',        key: '9b67989994f9def437ea68bb495f0162',    };    // 前端验证    config.jsValidator = {        client: {},        app: true,    };    config.filePath = '/etc/calc/files';    // 上传设置    config.multipart = {        whitelist: ['.json', '.txt',            '.xls', '.xlsx',            '.doc', '.docx',            '.pdf',            '.ppt', '.pptx',            '.png', '.jpg', '.jpeg', '.gif', '.bmp', '.cad', '.dwg',            '.zip', '.rar', '.7z', ''],        fileSize: '100mb',        fields: '15',    };    // 是否压缩替换前端js    config.min = true;    const file = path.join(__dirname, 'version');    if (fs.existsSync(file)) {        const versionStr = fs.readFileSync(file, 'utf8');        config.version = versionStr.split('\n')[0];    } else {        config.version = '1.0.5';    }    // 压缩设置    config.gzip = {        threshold: 2048,        // 下载的url要用正则忽略        ignore: /(\w*)(\/download\/file)|(\/profile\/qrCode)|(\/download\/compresse-file)|(\/compresse\/file)|(\/im-file\/download)(\w*)/ig,    };    config.customLogger = {        // 操作失败日志        fail: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'fail.log'),        },        // 以下为业务日志        ledger: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'ledger.log'),        },        stage: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'stage.log'),        },        mixed: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'mixed.log'),        },        finish: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'finish.log'),        },        warning: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'warning.log'),        },        out: {            file: path.join(appInfo.root, 'logs', appInfo.name, config.version, 'out.log'),        }    };    config.bodyParser = {        jsonLimit: '10mb',        formLimit: '10mb',    };    config.etag = {        weak: false,    };    config.wechatAll = {        appid: 'wx1c1cd8bae5836439',        appsecret: 'a35104f156faf19ab7a3ae4f990a1dd4',        token: 'smartcost3850888',        encodingAESKey: 'yjTsgluXZnsx5At4XjtOgeIZzmPuuFqoa3tLe25WxtC',        payment: {            partnerKey: '',            mchId: '',            notifyUrl: '',            pfx: '',        },        modules: {            message: true, // enable or disable co-wechat            api: true, // enable or disable co-wechat-api            oauth: true, // enable or disable co-wechat-oauth            payment: false, // enable or disable co-wechat-payment        },    };    // wx扫码登录    config.wxCode = {        appid: 'wx3d5394b238a3bc9a',        appsecret: '457d64c55f48f57cd22eca47e53d15cb',    };    config.proxy = true;    config.hisOssPath = 'prod/';    config.stashOssPath = 'stash/prod/';    config.oss = {        clients: {            signPdf: {                bucket: 'measure-sign-pdf',            },            fujian: {                bucket: 'jiliang-saas',            },            his: {                bucket: 'jiliang-his',            }        },        default: {            accessKeyId: 'LTAIALMjBHOs9PLA',            accessKeySecret: 'HSnULQs87wAJhcziAdyRv3GZ4EYctc',            endpoint: 'oss-cn-shenzhen-internal.aliyuncs.com',            timeout: '60s',        },    };    config.fujianOssPath = 'https://jiliang-saas-oss-cdn.smartcost.com.cn/';    config.fujianOssFolder = '';    config.syncUrl = 'http://sync.jl.smartcost.com.cn/';    // 项目管理跳转路径    config.managementPath = 'https://pm.smartcost.com.cn';    config.managementProxyPath = 'https://pm.smartcost.com.cn';    config.url3f = '/3f';    return config;};
 |