mirror of https://github.com/OpenVidu/openvidu.git
Merge branch 'master' of github.com:OpenVidu/openvidu
commit
151344ce59
|
@ -18,7 +18,6 @@
|
|||
package io.openvidu.server.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
|
@ -51,7 +50,6 @@ import com.google.gson.JsonSyntaxException;
|
|||
import io.openvidu.java.client.OpenViduRole;
|
||||
import io.openvidu.server.OpenViduServer;
|
||||
import io.openvidu.server.cdr.CDREventName;
|
||||
import io.openvidu.server.config.Dotenv.DotenvFormatException;
|
||||
import io.openvidu.server.recording.RecordingNotification;
|
||||
|
||||
@Component
|
||||
|
@ -105,8 +103,6 @@ public class OpenviduConfig {
|
|||
@Autowired
|
||||
protected Environment env;
|
||||
|
||||
protected Dotenv dotenv;
|
||||
|
||||
@Value("#{'${spring.profiles.active:}'.length() > 0 ? '${spring.profiles.active:}'.split(',') : \"default\"}")
|
||||
protected String springProfile;
|
||||
|
||||
|
@ -172,6 +168,8 @@ public class OpenviduConfig {
|
|||
|
||||
protected int openviduSessionsGarbageThreshold;
|
||||
|
||||
private String dotenvPath;
|
||||
|
||||
// Derived properties
|
||||
|
||||
public static String finalUrl;
|
||||
|
@ -290,6 +288,10 @@ public class OpenviduConfig {
|
|||
return openviduSessionsGarbageThreshold;
|
||||
}
|
||||
|
||||
public String getDotenvPath() {
|
||||
return dotenvPath;
|
||||
}
|
||||
|
||||
// Derived properties methods
|
||||
|
||||
public String getSpringProfile() {
|
||||
|
@ -371,13 +373,9 @@ public class OpenviduConfig {
|
|||
|
||||
Object valueObj = propertiesSource.get(property);
|
||||
if (valueObj != null) {
|
||||
if(valueObj instanceof Iterable) {
|
||||
value = JsonUtils.toJson(valueObj);
|
||||
} else {
|
||||
value = valueObj.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
value = env.getProperty(property);
|
||||
|
@ -410,16 +408,6 @@ public class OpenviduConfig {
|
|||
@PostConstruct
|
||||
public void checkConfiguration() {
|
||||
|
||||
dotenv = new Dotenv();
|
||||
|
||||
try {
|
||||
dotenv.read();
|
||||
} catch (IOException e) {
|
||||
log.warn("Exception reading .env file. " + e.getClass() + ":" + e.getMessage());
|
||||
} catch (DotenvFormatException e) {
|
||||
log.warn("Format error in .env file. " + e.getClass() + ":" + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
this.checkConfigurationProperties();
|
||||
} catch (Exception e) {
|
||||
|
@ -441,6 +429,8 @@ public class OpenviduConfig {
|
|||
|
||||
protected void checkConfigurationProperties() {
|
||||
|
||||
|
||||
|
||||
serverPort = getValue("server.port");
|
||||
|
||||
coturnRedisDbname = getValue("coturn.redis.dbname");
|
||||
|
@ -484,6 +474,7 @@ public class OpenviduConfig {
|
|||
|
||||
checkCertificateType();
|
||||
|
||||
dotenvPath = getValue("dotenv.path");
|
||||
}
|
||||
|
||||
private void checkCertificateType() {
|
||||
|
|
|
@ -203,8 +203,14 @@ public abstract class KmsManager {
|
|||
public void disconnected() {
|
||||
final Kms kms = kmss.get(kmsId);
|
||||
|
||||
log.info("Kurento Client \"disconnected\" event for KMS {} [{}]", kms.getUri(),
|
||||
if(kms.getKurentoClient().isClosed()) {
|
||||
log.info("Kurento Client \"disconnected\" event for KMS {} [{}]. Closed explicitely", kms.getUri(),
|
||||
kms.getKurentoClient().toString());
|
||||
return;
|
||||
} else {
|
||||
log.info("Kurento Client \"disconnected\" event for KMS {} [{}]. Waiting reconnection", kms.getUri(),
|
||||
kms.getKurentoClient().toString());
|
||||
}
|
||||
|
||||
kms.setKurentoClientConnected(false);
|
||||
kms.setTimeOfKurentoClientDisconnection(System.currentTimeMillis());
|
||||
|
@ -219,16 +225,26 @@ public abstract class KmsManager {
|
|||
try {
|
||||
if (kmsReconnectionLocks.get(kms.getId()).tryLock(5, TimeUnit.SECONDS)) {
|
||||
lockAcquired = true;
|
||||
|
||||
if (kms.isKurentoClientConnected()) {
|
||||
// reconnected listener already executed
|
||||
log.warn(
|
||||
log.info(
|
||||
"Timer of KMS with uri {} and KurentoClient [{}] cancelled (reconnected event received during interval wait)",
|
||||
kms.getUri(), kms.getKurentoClient().toString());
|
||||
timer.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if(kms.getKurentoClient().isClosed()) {
|
||||
log.info(
|
||||
"Timer of KMS with uri {} and KurentoClient [{}] has been closed. Cancelling Timer",
|
||||
kms.getUri(), kms.getKurentoClient().toString());
|
||||
timer.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
kms.getKurentoClient().getServerManager().getInfo();
|
||||
log.warn("According to Timer KMS with uri {} and KurentoClient [{}] is now reconnected",
|
||||
log.info("According to Timer KMS with uri {} and KurentoClient [{}] is now reconnected",
|
||||
kms.getUri(), kms.getKurentoClient().toString());
|
||||
timer.cancel();
|
||||
kms.setKurentoClientConnected(true);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"properties": [
|
||||
{"properties": [
|
||||
{
|
||||
"name": "kms.uris",
|
||||
"type": "java.lang.String",
|
||||
|
@ -213,6 +212,15 @@
|
|||
"type": "java.lang.Long",
|
||||
"description": "Maximum number of websocket sessions that openvidu-server will be able to hold",
|
||||
"defaultValue": 9223372036854775807
|
||||
},
|
||||
{
|
||||
"name": "certificate.type",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'certificate.type'"
|
||||
},
|
||||
{
|
||||
"name": "dotenvpath",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'dotenvpath'"
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
|
@ -44,3 +44,5 @@ coturn.redis.ip=127.0.0.1
|
|||
coturn.redis.dbname=0
|
||||
coturn.redis.password=turn
|
||||
coturn.redis.connect-timeout=30
|
||||
|
||||
dotenv.path=.
|
||||
|
|
Loading…
Reference in New Issue