mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-08 07:23:10 -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 (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common"
|
"github.com/matrix-org/dendrite/common"
|
||||||
"github.com/matrix-org/dendrite/mediaapi/config"
|
"github.com/matrix-org/dendrite/mediaapi/config"
|
||||||
|
|
@ -48,11 +49,16 @@ func main() {
|
||||||
if serverName == "" {
|
if serverName == "" {
|
||||||
serverName = "localhost"
|
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{
|
cfg := &config.MediaAPI{
|
||||||
ServerName: types.ServerName(serverName),
|
ServerName: types.ServerName(serverName),
|
||||||
BasePath: types.Path(basePath),
|
BasePath: types.Path(basePath),
|
||||||
MaxFileSizeBytes: 10 * 1024 * 1024,
|
MaxFileSizeBytes: types.ContentLength(maxFileSizeBytes),
|
||||||
DataSource: dataSource,
|
DataSource: dataSource,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue