openvidu-server: public URL to plain HTTP if DEV_CONTAINER

pull/672/merge
pabloFuente 2022-07-27 12:07:45 +02:00
parent fd83b6693a
commit ee2c3d009b
2 changed files with 8 additions and 2 deletions

View File

@ -125,6 +125,9 @@ public class OpenviduConfig {
@Value("#{'${spring.profiles.active:}'.length() > 0 ? '${spring.profiles.active:}'.split(',') : \"default\"}") @Value("#{'${spring.profiles.active:}'.length() > 0 ? '${spring.profiles.active:}'.split(',') : \"default\"}")
protected String springProfile; protected String springProfile;
@Value("${DEV_CONTAINER:false}")
private boolean devContainer;
// Config properties // Config properties
private boolean openviduCdr; private boolean openviduCdr;
@ -704,7 +707,7 @@ public class OpenviduConfig {
if (domain != null && !domain.isEmpty()) { if (domain != null && !domain.isEmpty()) {
this.domainOrPublicIp = domain; this.domainOrPublicIp = domain;
this.openviduPublicUrl = "https://" + domain; this.openviduPublicUrl = (devContainer ? "http://" : "https://") + domain;
if (this.httpsPort != null && this.httpsPort != 443) { if (this.httpsPort != null && this.httpsPort != 443) {
this.openviduPublicUrl += (":" + this.httpsPort); this.openviduPublicUrl += (":" + this.httpsPort);
} }
@ -756,7 +759,7 @@ public class OpenviduConfig {
if (publicUrl.startsWith("https://")) { if (publicUrl.startsWith("https://")) {
OpenViduServer.wsUrl = publicUrl.replace("https://", "wss://"); OpenViduServer.wsUrl = publicUrl.replace("https://", "wss://");
} else if (publicUrl.startsWith("http://")) { } else if (publicUrl.startsWith("http://")) {
OpenViduServer.wsUrl = publicUrl.replace("http://", "wss://"); OpenViduServer.wsUrl = publicUrl.replace("http://", "ws://");
} }
if (OpenViduServer.wsUrl.endsWith("/")) { if (OpenViduServer.wsUrl.endsWith("/")) {
OpenViduServer.wsUrl = OpenViduServer.wsUrl.substring(0, OpenViduServer.wsUrl.length() - 1); OpenViduServer.wsUrl = OpenViduServer.wsUrl.substring(0, OpenViduServer.wsUrl.length() - 1);

View File

@ -1,3 +1,6 @@
server.address=0.0.0.0
server.ssl.enabled=false
DEV_CONTAINER=true
DOMAIN_OR_PUBLIC_IP=localhost DOMAIN_OR_PUBLIC_IP=localhost
OPENVIDU_SECRET=MY_SECRET OPENVIDU_SECRET=MY_SECRET
HTTPS_PORT=4443 HTTPS_PORT=4443