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