mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
cmd/dendrite-media-api-server: Make base path absolute
This commit is contained in:
parent
f5422787a1
commit
995e1f2c99
|
|
@ -17,6 +17,7 @@ package main
|
|||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
|
|
@ -47,6 +48,10 @@ func main() {
|
|||
if basePath == "" {
|
||||
log.Panic("No BASE_PATH environment variable found.")
|
||||
}
|
||||
absBasePath, err := filepath.Abs(basePath)
|
||||
if err != nil {
|
||||
log.Panicf("BASE_PATH is invalid (must be able to make absolute): %v\n", err)
|
||||
}
|
||||
|
||||
if serverName == "" {
|
||||
serverName = "localhost"
|
||||
|
|
@ -59,7 +64,7 @@ func main() {
|
|||
|
||||
cfg := &config.MediaAPI{
|
||||
ServerName: gomatrixserverlib.ServerName(serverName),
|
||||
BasePath: types.Path(basePath),
|
||||
BasePath: types.Path(absBasePath),
|
||||
MaxFileSizeBytes: types.ContentLength(maxFileSizeBytes),
|
||||
DataSource: dataSource,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue