/** * Created by Julin on 2021/04/02. */ 'use strict'; const path = require('path'); const os = require('os'); const dev = process.env.NODE_ENV == 'development'; const ANXINCLOUD_FC_CLOUD = process.env.ANXINCLOUD_FC_CLOUD; const ANXINCLOUD_FC_LOCAL_SVR_ORIGIN = process.env.ANXINCLOUD_FC_LOCAL_SVR_ORIGIN; const ANXINCLOUD_FC_LOCAL_ROOT_PATH = process.env.ANXINCLOUD_FC_LOCAL_ROOT_PATH; const PORT = 4000; const product = { port: PORT, staticDirs: [path.join(__dirname, ANXINCLOUD_FC_LOCAL_ROOT_PATH || 'static')], mws: [{ entry: require('../index').entry, opts: Object.assign({ routePrefix: '_file-server', uploadPath: 'other', maxSize: 10485760 // 10M }, ANXINCLOUD_FC_CLOUD == 'true' ? { qiniu: { domain: 'http://p7q1f8t1p.bkt.clouddn.com', bucket: 'anxinyun-test', accessKey: "5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu", secretKey: "w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5" } } : { local: { origin: ANXINCLOUD_FC_LOCAL_SVR_ORIGIN || `localhost:${PORT}`, rootPath: 'static', childPath: 'upload' } }) }], dc: { url: 'postgres://FashionAdmin:123456@10.8.30.39:5432/axy', opts: { pool: { max: 20, min: 10, idle: 10000 }, define: { freezeTableName: true, // 固定表名 timestamps: false // 不含列 "createAt"/"updateAt"/"DeleteAt" }, timezone: '+08:00', logging: false }, models: [] }, logger: { level: 'info', json: false, filename: path.join(__dirname, 'log', 'runtime.test.log'), colorize: false, maxsize: 1024 * 1024 * 5, rotationFormat: false, zippedArchive: true, maxFiles: 10, prettyPrint: true, label: '', timestamp: true, eol: os.EOL, tailable: true, depth: null, showLevel: true, maxRetries: 1 } }; const development = { port: product.port, mws: product.mws, dc: product.dc, logger: product.logger }; if (dev) { // logger development.logger.filename = path.join(__dirname, 'log', 'development.test.log'); development.logger.level = 'debug'; development.dc.opts.logging = console.log; } module.exports = dev ? development : product;