Skip to content

Commit a31cb1b

Browse files
committed
View all sources in getString
1 parent 938e591 commit a31cb1b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/ConfigProvider.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,19 @@ public <T extends Enum<T>> T getEnum(String key, Class<T> enumType, T defaultVal
7474
}
7575

7676
public String getString(String key, String defaultValue, String... aliases) {
77+
String value = null;
7778
for (ConfigProvider.Source source : sources) {
78-
String value = source.get(key, aliases);
79-
if (value != null) {
80-
if (collectConfig) {
81-
ConfigCollector.get().put(key, value, source.origin());
82-
}
83-
return value;
79+
value = source.get(key, aliases);
80+
if (value != null && collectConfig) {
81+
ConfigCollector.get().put(key, value, source.origin());
8482
}
8583
}
8684
if (collectConfig) {
8785
ConfigCollector.get().put(key, defaultValue, ConfigOrigin.DEFAULT);
8886
}
87+
if (value != null) {
88+
return value;
89+
}
8990
return defaultValue;
9091
}
9192

0 commit comments

Comments
 (0)