Enhance server configuration for large file uploads and improve token handling. Increase request body size limit in the server to 20 GB, update registration token expiration logic to support infinite expiration, and adjust database schema to accommodate larger file sizes. Add detailed logging for file upload processes and error handling improvements.
This commit is contained in:
@@ -46,13 +46,26 @@ func main() {
|
||||
log.Fatalf("Failed to create server: %v", err)
|
||||
}
|
||||
|
||||
// Start server
|
||||
// Start server with increased request body size limit for large file uploads
|
||||
addr := fmt.Sprintf(":%s", *port)
|
||||
log.Printf("Starting manager server on %s", addr)
|
||||
log.Printf("Database: %s", *dbPath)
|
||||
log.Printf("Storage: %s", *storagePath)
|
||||
|
||||
if err := http.ListenAndServe(addr, server); err != nil {
|
||||
httpServer := &http.Server{
|
||||
Addr: addr,
|
||||
Handler: server,
|
||||
MaxHeaderBytes: 1 << 20, // 1 MB for headers
|
||||
ReadTimeout: 0, // No read timeout (for large uploads)
|
||||
WriteTimeout: 0, // No write timeout (for large uploads)
|
||||
}
|
||||
|
||||
// Note: MaxRequestBodySize is not directly configurable in http.Server
|
||||
// It's handled by ParseMultipartForm in handlers, which we've already configured
|
||||
// But we need to ensure the server can handle large requests
|
||||
// The default limit is 10MB, but we bypass it by using ParseMultipartForm with larger limit
|
||||
|
||||
if err := httpServer.ListenAndServe(); err != nil {
|
||||
log.Fatalf("Server failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user