Allow customizing the list of supported resources

This commit is contained in:
James Agnew
2019-07-04 09:48:40 -04:00
parent bea5b0947f
commit 3c6343e20d
3 changed files with 34 additions and 0 deletions

View File

@@ -8,7 +8,12 @@ import com.google.common.annotations.VisibleForTesting;
import java.io.InputStream;
import java.io.FileInputStream;
import java.util.Arrays;
import java.util.Properties;
import java.util.Set;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.*;
public class HapiProperties {
static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references";
@@ -268,6 +273,14 @@ public class HapiProperties {
return HapiProperties.getProperty(CORS_ALLOWED_ORIGIN, "*");
}
public static Set<String> getSupportedResourceTypes() {
String[] types = defaultString(getProperty("supported_resource_types")).split(",");
return Arrays.stream(types)
.map(t->trim(t))
.filter(t->isNotBlank(t))
.collect(Collectors.toSet());
}
public static String getServerName() {
return HapiProperties.getProperty(SERVER_NAME, "Local Tester");
}