Skip to content

Commit 44e8542

Browse files
committed
added utility method in ParaConfig
1 parent 50a970a commit 44e8542

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

para-core/src/main/java/com/erudika/para/core/utils/ParaConfig.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
import com.typesafe.config.ConfigList;
2424
import com.typesafe.config.ConfigObject;
2525
import java.nio.file.Paths;
26+
import java.util.Collections;
2627
import java.util.HashMap;
28+
import java.util.List;
2729
import java.util.Map;
2830
import org.apache.commons.lang3.StringUtils;
2931
import org.apache.commons.lang3.Strings;
3032
import org.apache.commons.lang3.math.NumberUtils;
33+
import org.apache.commons.lang3.stream.Streams;
3134

3235
/**
3336
* Para configuration.
@@ -2046,6 +2049,21 @@ public boolean landingPageEnabled() {
20462049
return getConfigBoolean("landing_page_enabled", true);
20472050
}
20482051

2052+
/**
2053+
* Returns the list of regions where a table should be replicated (global table).
2054+
* Currently, this is only used in combination with DynamoDB and SQS but could be implemented with other services.
2055+
* @return a list of regions
2056+
*/
2057+
public List<String> replicaRegions() {
2058+
if (!StringUtils.isBlank(awsDynamoReplicaRegions())) {
2059+
String[] regions = Para.getConfig().awsDynamoReplicaRegions().split("\\s*,\\s*");
2060+
if (regions != null && regions.length > 0) {
2061+
return Streams.of(regions).filter(StringUtils::isNotBlank).toList();
2062+
}
2063+
}
2064+
return Collections.emptyList();
2065+
}
2066+
20492067
/**
20502068
* @return Development environment flag.
20512069
*/

0 commit comments

Comments
 (0)