cmd/dendrite-media-api-server: Add SERVER_NAME configuration

This commit is contained in:
Robert Swain 2017-05-18 11:32:30 +02:00
parent deee6f84c7
commit ff3009ffdd

View file

@ -22,6 +22,7 @@ import (
"github.com/matrix-org/dendrite/mediaapi/config" "github.com/matrix-org/dendrite/mediaapi/config"
"github.com/matrix-org/dendrite/mediaapi/routing" "github.com/matrix-org/dendrite/mediaapi/routing"
"github.com/matrix-org/dendrite/mediaapi/storage" "github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/types"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
) )
@ -30,6 +31,7 @@ var (
bindAddr = os.Getenv("BIND_ADDRESS") bindAddr = os.Getenv("BIND_ADDRESS")
dataSource = os.Getenv("DATABASE") dataSource = os.Getenv("DATABASE")
logDir = os.Getenv("LOG_DIR") logDir = os.Getenv("LOG_DIR")
serverName = os.Getenv("SERVER_NAME")
) )
func main() { func main() {
@ -39,8 +41,12 @@ func main() {
log.Panic("No BIND_ADDRESS environment variable found.") log.Panic("No BIND_ADDRESS environment variable found.")
} }
if serverName == "" {
serverName = "localhost"
}
cfg := &config.MediaAPI{ cfg := &config.MediaAPI{
ServerName: "localhost", ServerName: types.ServerName(serverName),
BasePath: "/Users/robertsw/dendrite", BasePath: "/Users/robertsw/dendrite",
MaxFileSize: 10 * 1024 * 1024, MaxFileSize: 10 * 1024 * 1024,
DataSource: dataSource, DataSource: dataSource,