mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
cmd/dendrite-media-api-server: Add MAX_FILE_SIZE_BYTES configuration
This commit is contained in:
parent
846aece163
commit
7727a8c61e
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue