根据 inDev 来设置dev和prod的不同环境变量值

This commit is contained in:
陆柯 2022-06-05 09:35:12 +08:00
parent 70090785b5
commit 383235168d

View File

@ -4,13 +4,12 @@ const crypto = require('crypto')
const wo = global.wo
module.exports = {
MulterStore: multer({
// dest:'./File/', // 这样,不能自定义文件名。
storage: multer.diskStorage({
destination (req, file, cb) {
// 如果直接提供字符串multer会负责创建该目录。如果提供函数你要负责确保该目录存在。
cb(null, wo?.envar?.File_Store) // 目录是相对于本应用的入口js的即相对于 server.js 的位置。
cb(null, wo?.envar?.fileStore) // 目录是相对于本应用的入口js的即相对于 server.js 的位置。
},
filename (req, file, cb) {
// 注意req.body 也许还没有信息因为这取决于客户端发送body和file的顺序。必要的信息请从 req.headers 传递,例如 _passtoken在multer时尚未进入路由不存在已装好的 _passtokenSource
@ -35,7 +34,6 @@ module.exports = {
} else {
return { _state: 'BASEND_FAIL_FILE_NOT_RECEIVED' }
}
}
}
},
},
}