From a22a2ae031f2c02b41aa9a7c1746b2989bcf0126 Mon Sep 17 00:00:00 2001 From: James Mills Date: Sun, 29 Mar 2020 17:41:10 +1000 Subject: Add maximum upload size saftey and guards --- app/config.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'app/config.go') diff --git a/app/config.go b/app/config.go index 73871eb..4d72657 100644 --- a/app/config.go +++ b/app/config.go @@ -22,10 +22,11 @@ type PathConfig struct { // ServerConfig settings for App Server. type ServerConfig struct { - Host string `json:"host"` - Port int `json:"port"` - StorePath string `json:"store_path"` - UploadPath string `json:"upload_path"` + Host string `json:"host"` + Port int `json:"port"` + StorePath string `json:"store_path"` + UploadPath string `json:"upload_path"` + MaxUploadSize int64 `json:"max_upload_size"` } // ThumbnailerConfig settings for Transcoder @@ -61,15 +62,16 @@ func DefaultConfig() *Config { }, }, Server: &ServerConfig{ - Host: "127.0.0.1", - Port: 0, - UploadPath: "uploads", + Host: "0.0.0.0", + Port: 8000, + UploadPath: "uploads", + MaxUploadSize: 104857600, }, Thumbnailer: &ThumbnailerConfig{ - Timeout: 30, + Timeout: 60, }, Transcoder: &TranscoderConfig{ - Timeout: 60, + Timeout: 300, }, Feed: &FeedConfig{ ExternalURL: "http://localhost", -- cgit v1.2.3