fix startup with -dev and -config (#2442)
This commit is contained in:
+2
-11
@@ -29,7 +29,6 @@ import (
|
|||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/rtc"
|
"github.com/livekit/livekit-server/pkg/rtc"
|
||||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||||
"github.com/livekit/mediatransportutil/pkg/rtcconfig"
|
|
||||||
"github.com/livekit/protocol/logger"
|
"github.com/livekit/protocol/logger"
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/config"
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
@@ -205,11 +204,7 @@ func getConfig(c *cli.Context) (*config.Config, error) {
|
|||||||
}
|
}
|
||||||
config.InitLoggerFromConfig(&conf.Logging)
|
config.InitLoggerFromConfig(&conf.Logging)
|
||||||
|
|
||||||
if c.String("config") == "" && c.String("config-body") == "" && conf.Development {
|
if conf.Development {
|
||||||
// use single port UDP when no config is provided
|
|
||||||
conf.RTC.UDPPort = rtcconfig.PortRange{Start: 7882}
|
|
||||||
conf.RTC.ICEPortRangeStart = 0
|
|
||||||
conf.RTC.ICEPortRangeEnd = 0
|
|
||||||
logger.Infow("starting in development mode")
|
logger.Infow("starting in development mode")
|
||||||
|
|
||||||
if len(conf.Keys) == 0 {
|
if len(conf.Keys) == 0 {
|
||||||
@@ -248,10 +243,6 @@ func getConfig(c *cli.Context) (*config.Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startServer(c *cli.Context) error {
|
func startServer(c *cli.Context) error {
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
|
|
||||||
memProfile := c.String("memprofile")
|
|
||||||
|
|
||||||
conf, err := getConfig(c)
|
conf, err := getConfig(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -263,7 +254,7 @@ func startServer(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if memProfile != "" {
|
if memProfile := c.String("memprofile"); memProfile != "" {
|
||||||
if f, err := os.Create(memProfile); err != nil {
|
if f, err := os.Create(memProfile); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -516,16 +516,16 @@ func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := conf.RTC.Validate(conf.Development); err != nil {
|
|
||||||
return nil, fmt.Errorf("could not validate RTC config: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if c != nil {
|
if c != nil {
|
||||||
if err := conf.updateFromCLI(c, baseFlags); err != nil {
|
if err := conf.updateFromCLI(c, baseFlags); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := conf.RTC.Validate(conf.Development); err != nil {
|
||||||
|
return nil, fmt.Errorf("could not validate RTC config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// expand env vars in filenames
|
// expand env vars in filenames
|
||||||
file, err := homedir.Expand(os.ExpandEnv(conf.KeyFile))
|
file, err := homedir.Expand(os.ExpandEnv(conf.KeyFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user