Explorar o código

set default stun server if unset

abhishek9686 hai 2 semanas
pai
achega
a3df9af566
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. 3 0
      migrate/migrate.go
  2. 5 1
      servercfg/serverconf.go

+ 3 - 0
migrate/migrate.go

@@ -821,6 +821,9 @@ func migrateSettings() {
 	if settings.JwtValidityDurationClients == 0 {
 	if settings.JwtValidityDurationClients == 0 {
 		settings.JwtValidityDurationClients = servercfg.GetJwtValidityDurationFromEnv() / 60
 		settings.JwtValidityDurationClients = servercfg.GetJwtValidityDurationFromEnv() / 60
 	}
 	}
+	if settings.StunServers == "" {
+		settings.StunServers = servercfg.GetStunServers()
+	}
 	logic.UpsertServerSettings(settings)
 	logic.UpsertServerSettings(settings)
 }
 }
 
 

+ 5 - 1
servercfg/serverconf.go

@@ -750,7 +750,11 @@ func IsStunEnabled() bool {
 }
 }
 
 
 func GetStunServers() string {
 func GetStunServers() string {
-	return os.Getenv("STUN_SERVERS")
+	stunservers := os.Getenv("STUN_SERVERS")
+	if stunservers == "" {
+		stunservers = "stun1.l.google.com:19302,stun2.l.google.com:19302,stun3.l.google.com:19302,stun4.l.google.com:19302"
+	}
+	return stunservers
 }
 }
 
 
 // GetEnvironment returns the environment the server is running in (e.g. dev, staging, prod...)
 // GetEnvironment returns the environment the server is running in (e.g. dev, staging, prod...)