openvidu-server: new OPENVIDU_PRO_AWS_S3_HEADERS property

pull/438/merge
pabloFuente 2020-12-16 11:23:26 +01:00
parent 183f699eab
commit bd3b0f5b66
2 changed files with 29 additions and 0 deletions

View File

@ -168,6 +168,13 @@ OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY=streams
# if OPENVIDU_PRO_RECORDING_STORAGE=s3
#OPENVIDU_PRO_AWS_S3_BUCKET=
# If OPENVIDU_PRO_RECORDING_STORAGE=s3, the collection of HTTP header values that the internal AWS client will use during
# the upload process. The property is a key-value map of strings, following the format of a JSON object. For example, for applying
# server-side encryption with AES-256, this header is mandatory: {"x-amz-server-side-encryption":"AES256"}.
# The list of available headers can be found here: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/Headers.html
# This property is only taken into account if OPENVIDU_PRO_RECORDING_STORAGE=s3
#OPENVIDU_PRO_AWS_S3_HEADERS=
# If you're instance has a role which has access to read
# and write into the s3 bucket, you don't need this parameter
# OPENVIDU_PRO_AWS_ACCESS_KEY=

View File

@ -34,6 +34,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.PostConstruct;
@ -51,6 +52,8 @@ import org.springframework.stereotype.Component;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import io.openvidu.java.client.OpenViduRole;
@ -906,6 +909,25 @@ public class OpenviduConfig {
}
}
protected Map<String, String> asOptionalStringMap(String property) {
Map<String, String> map = new HashMap<>();
String str = getValue(property);
if (str != null && !str.isEmpty()) {
try {
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(str, JsonObject.class);
for (Entry<String, JsonElement> entry : jsonObject.entrySet()) {
map.put(entry.getKey(), entry.getValue().getAsString());
}
return map;
} catch (JsonSyntaxException e) {
addError(property, "Is not a valid map of strings. " + e.getMessage());
return map;
}
}
return map;
}
public URI checkWebsocketUri(String uri) throws Exception {
try {
if (!StringUtils.startsWithAny(uri, "ws://", "wss://")) {