mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-09 07:53:11 -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 (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common"
|
"github.com/matrix-org/dendrite/common"
|
||||||
|
|
@ -47,6 +48,10 @@ func main() {
|
||||||
if basePath == "" {
|
if basePath == "" {
|
||||||
log.Panic("No BASE_PATH environment variable found.")
|
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 == "" {
|
if serverName == "" {
|
||||||
serverName = "localhost"
|
serverName = "localhost"
|
||||||
|
|
@ -59,7 +64,7 @@ func main() {
|
||||||
|
|
||||||
cfg := &config.MediaAPI{
|
cfg := &config.MediaAPI{
|
||||||
ServerName: gomatrixserverlib.ServerName(serverName),
|
ServerName: gomatrixserverlib.ServerName(serverName),
|
||||||
BasePath: types.Path(basePath),
|
BasePath: types.Path(absBasePath),
|
||||||
MaxFileSizeBytes: types.ContentLength(maxFileSizeBytes),
|
MaxFileSizeBytes: types.ContentLength(maxFileSizeBytes),
|
||||||
DataSource: dataSource,
|
DataSource: dataSource,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue