Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
public final class TerracottaNodeList {
private static final String NODE_LIST_URL = "https://terracotta.glavo.site/nodes";

private static String maskForLog(String s) {
if (s == null || s.isEmpty()) return "";
int half = s.length() / 2;
return s.substring(0, half) + "*".repeat(s.length() - half);
}

@JsonSerializable
private record TerracottaNode(String url, @Nullable String region) implements Validation {
@Override
Expand Down Expand Up @@ -78,15 +84,15 @@ public static List<URI> fetch() {
try {
node.validate();
} catch (Exception e) {
LOG.warning("Invalid terracotta node: " + node, e);
LOG.warning("Invalid terracotta node: " + maskForLog(node.toString()), e);
return false;
}

return StringUtils.isBlank(node.region) || LocaleUtils.IS_CHINA_MAINLAND == "CN".equalsIgnoreCase(node.region);
})
.map(it -> URI.create(it.url()))
.toList();
LOG.info("Terracotta node list: " + list);
LOG.info("Terracotta node list: " + list.stream().map(uri -> maskForLog(uri.toString())).toList());
}
} catch (Exception e) {
LOG.warning("Failed to fetch terracotta node list", e);
Expand Down