diff --git a/src/github.com/matrix-org/dendrite/cmd/dendrite-media-api-server/main.go b/src/github.com/matrix-org/dendrite/cmd/dendrite-media-api-server/main.go index 3dcf74b12..1d66a4183 100644 --- a/src/github.com/matrix-org/dendrite/cmd/dendrite-media-api-server/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/dendrite-media-api-server/main.go @@ -17,6 +17,7 @@ package main import ( "net/http" "os" + "strconv" "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/mediaapi/config" @@ -48,11 +49,16 @@ func main() { if serverName == "" { serverName = "localhost" } + maxFileSizeBytes, err := strconv.ParseInt(os.Getenv("MAX_FILE_SIZE_BYTES"), 10, 64) + if err != nil { + maxFileSizeBytes = 10 * 1024 * 1024 + log.Info("Failed to parse MAX_FILE_SIZE_BYTES. Defaulting to %v bytes.", maxFileSizeBytes) + } cfg := &config.MediaAPI{ ServerName: types.ServerName(serverName), BasePath: types.Path(basePath), - MaxFileSizeBytes: 10 * 1024 * 1024, + MaxFileSizeBytes: types.ContentLength(maxFileSizeBytes), DataSource: dataSource, }