mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: ngrok environment updated
parent
7c871218ef
commit
bb2e120991
|
@ -34,8 +34,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
|
@ -73,6 +75,8 @@ public class OpenViduServer implements JsonRpcConfigurer {
|
|||
|
||||
public static String publicUrl;
|
||||
|
||||
private String ngrokAppUrl = "";
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public KurentoClientProvider kmsManager() {
|
||||
|
@ -166,20 +170,19 @@ public class OpenViduServer implements JsonRpcConfigurer {
|
|||
case "ngrok":
|
||||
try {
|
||||
NgrokRestController ngrok = new NgrokRestController();
|
||||
String ngrokAppUrl = ngrok.getNgrokAppUrl();
|
||||
ngrokAppUrl = ngrok.getNgrokAppUrl();
|
||||
if (ngrokAppUrl.isEmpty()) {
|
||||
ngrokAppUrl = "(No tunnel 'app' found in ngrok.yml)";
|
||||
}
|
||||
final String NEW_LINE = System.getProperty("line.separator");
|
||||
String str = NEW_LINE +
|
||||
NEW_LINE + " APP PUBLIC IP " +
|
||||
NEW_LINE + "-------------------------" +
|
||||
NEW_LINE + ngrokAppUrl +
|
||||
NEW_LINE + "-------------------------" +
|
||||
NEW_LINE;
|
||||
log.info(str);
|
||||
OpenViduServer.publicUrl = ngrok.getNgrokServerUrl().replaceFirst("https://", "wss://");
|
||||
openviduConf.setFinalUrl(ngrok.getNgrokServerUrl());
|
||||
|
||||
// For frontend-only applications overriding openvidu-server dashboard...
|
||||
String ngrokServerUrl = ngrok.getNgrokServerUrl();
|
||||
if (ngrokServerUrl.isEmpty()) {
|
||||
ngrokServerUrl = ngrok.getNgrokAppUrl();
|
||||
}
|
||||
|
||||
OpenViduServer.publicUrl = ngrokServerUrl.replaceFirst("https://", "wss://");
|
||||
openviduConf.setFinalUrl(ngrokServerUrl);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Ngrok URL was configured, but there was an error connecting to ngrok: "
|
||||
|
@ -292,4 +295,18 @@ public class OpenViduServer implements JsonRpcConfigurer {
|
|||
log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
|
||||
}
|
||||
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void printNgrokUrl() {
|
||||
if (!this.ngrokAppUrl.isEmpty()) {
|
||||
final String NEW_LINE = System.getProperty("line.separator");
|
||||
String str = NEW_LINE +
|
||||
NEW_LINE + " APP PUBLIC IP " +
|
||||
NEW_LINE + "-------------------------" +
|
||||
NEW_LINE + ngrokAppUrl +
|
||||
NEW_LINE + "-------------------------" +
|
||||
NEW_LINE;
|
||||
log.info(str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue