Rabbit-R1/switch port/java/sources/io/sentry/config/EnvironmentVariablePropertiesProvider.java
2024-05-21 17:08:36 -04:00

34 lines
1.4 KiB
Java

package io.sentry.config;
import io.sentry.util.StringUtils;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/* loaded from: classes3.dex */
final class EnvironmentVariablePropertiesProvider implements PropertiesProvider {
private static final String PREFIX = "SENTRY";
@Override // io.sentry.config.PropertiesProvider
public String getProperty(String str) {
return StringUtils.removeSurrounding(System.getenv(propertyToEnvironmentVariableName(str)), "\"");
}
@Override // io.sentry.config.PropertiesProvider
public Map<String, String> getMap(String str) {
String removeSurrounding;
String str2 = propertyToEnvironmentVariableName(str) + "_";
ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
String key = entry.getKey();
if (key.startsWith(str2) && (removeSurrounding = StringUtils.removeSurrounding(entry.getValue(), "\"")) != null) {
concurrentHashMap.put(key.substring(str2.length()).toLowerCase(Locale.ROOT), removeSurrounding);
}
}
return concurrentHashMap;
}
private String propertyToEnvironmentVariableName(String str) {
return "SENTRY_" + str.replace(".", "_").replace("-", "_").toUpperCase(Locale.ROOT);
}
}