mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: update config REST controller (GET openvidu-server version)
parent
58685db2df
commit
dfac25d360
|
@ -82,6 +82,12 @@
|
||||||
<layout>ZIP</layout>
|
<layout>ZIP</layout>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-info</id>
|
||||||
|
<goals>
|
||||||
|
<goal>build-info</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal>
|
<goal>repackage</goal>
|
||||||
|
@ -136,6 +142,12 @@
|
||||||
<classifier>exec</classifier>
|
<classifier>exec</classifier>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-info</id>
|
||||||
|
<goals>
|
||||||
|
<goal>build-info</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal>
|
<goal>repackage</goal>
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
|
|
||||||
package io.openvidu.server.config;
|
package io.openvidu.server.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.info.BuildProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import io.openvidu.server.core.ParticipantRole;
|
import io.openvidu.server.core.ParticipantRole;
|
||||||
|
@ -25,6 +27,9 @@ import io.openvidu.server.core.ParticipantRole;
|
||||||
@Component
|
@Component
|
||||||
public class OpenviduConfig {
|
public class OpenviduConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BuildProperties buildProperties;
|
||||||
|
|
||||||
@Value("${openvidu.publicurl}")
|
@Value("${openvidu.publicurl}")
|
||||||
private String openviduPublicUrl; // local, docker, [FINAL_URL]
|
private String openviduPublicUrl; // local, docker, [FINAL_URL]
|
||||||
|
|
||||||
|
@ -90,6 +95,10 @@ public class OpenviduConfig {
|
||||||
|
|
||||||
private String finalUrl;
|
private String finalUrl;
|
||||||
|
|
||||||
|
public String getOpenViduServerVersion() {
|
||||||
|
return this.buildProperties.getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
public String getOpenViduPublicUrl() {
|
public String getOpenViduPublicUrl() {
|
||||||
return this.openviduPublicUrl;
|
return this.openviduPublicUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,17 @@
|
||||||
package io.openvidu.server.rest;
|
package io.openvidu.server.rest;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import io.openvidu.server.config.OpenviduConfig;
|
import io.openvidu.server.config.OpenviduConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +43,11 @@ public class ConfigRestController {
|
||||||
@Autowired
|
@Autowired
|
||||||
protected OpenviduConfig openviduConfig;
|
protected OpenviduConfig openviduConfig;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/openvidu-version", method = RequestMethod.GET)
|
||||||
|
public String getOpenViduServerVersion() {
|
||||||
|
return openviduConfig.getOpenViduServerVersion();
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/openvidu-publicurl", method = RequestMethod.GET)
|
@RequestMapping(value = "/openvidu-publicurl", method = RequestMethod.GET)
|
||||||
public String getOpenViduPublicUrl() {
|
public String getOpenViduPublicUrl() {
|
||||||
return openviduConfig.getFinalUrl();
|
return openviduConfig.getFinalUrl();
|
||||||
|
@ -52,4 +63,25 @@ public class ConfigRestController {
|
||||||
return openviduConfig.getOpenViduRecordingPath();
|
return openviduConfig.getOpenViduRecordingPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
|
public ResponseEntity<?> getOpenViduConfiguration() {
|
||||||
|
|
||||||
|
JsonObject json = new JsonObject();
|
||||||
|
json.addProperty("openviduServerVersion", openviduConfig.getOpenViduServerVersion());
|
||||||
|
json.addProperty("openviduPublicurl", openviduConfig.getOpenViduPublicUrl());
|
||||||
|
json.addProperty("openviduRecording", openviduConfig.isRecordingModuleEnabled());
|
||||||
|
json.addProperty("openviduRecordingPublicAccess", openviduConfig.getOpenViduRecordingPublicAccess());
|
||||||
|
json.addProperty("openviduRecordingPath", openviduConfig.getOpenViduRecordingPath());
|
||||||
|
json.addProperty("openviduRecordingVersion", openviduConfig.getOpenViduRecordingVersion());
|
||||||
|
|
||||||
|
HttpHeaders responseHeaders = new HttpHeaders();
|
||||||
|
responseHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
return new ResponseEntity<>(json.toString(), responseHeaders, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/restart", method = RequestMethod.POST)
|
||||||
|
public void restart() {
|
||||||
|
// OpenViduServer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue