mirror of
https://github.com/livekit/livekit.git
synced 2026-10-23 19:32:41 +00:00
fix startup with -dev and -config (#2442)
This commit is contained in:
1 parent
f26fbceaba
commit
4bce0e7ed4
2 files changed
+6
-15
No files matched your search
+2
-11
@@ -29,7 +29,6 @@ import (
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||
"github.com/livekit/mediatransportutil/pkg/rtcconfig"
|
||||
"github.com/livekit/protocol/logger"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
@@ -205,11 +204,7 @@ func getConfig(c *cli.Context) (*config.Config, error) {
|
||||
}
|
||||
config.InitLoggerFromConfig(&conf.Logging)
|
||||
|
||||
if c.String("config") == "" && c.String("config-body") == "" && 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
|
||||
if conf.Development {
|
||||
logger.Infow("starting in development mode")
|
||||
|
||||
if len(conf.Keys) == 0 {
|
||||
@@ -248,10 +243,6 @@ func getConfig(c *cli.Context) (*config.Config, error) {
|
||||
}
|
||||
|
||||
func startServer(c *cli.Context) error {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
memProfile := c.String("memprofile")
|
||||
|
||||
conf, err := getConfig(c)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -263,7 +254,7 @@ func startServer(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if memProfile != "" {
|
||||
if memProfile := c.String("memprofile"); memProfile != "" {
|
||||
if f, err := os.Create(memProfile); err != nil {
|
||||
return err
|
||||
} 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 err := conf.updateFromCLI(c, baseFlags); err != nil {
|
||||
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
|
||||
file, err := homedir.Expand(os.ExpandEnv(conf.KeyFile))
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user