@@ -25,26 +25,28 @@ public class Configuration {
25
25
public static final String METRICS_ADDRESS = "metrics.address" ;
26
26
public static final String METRICS_PORT = "metrics.port" ;
27
27
28
- private Optional <String > inferenceKey ;
29
- private Optional <String > inferenceAddress ;
30
- private Optional <Integer > inferencePort ;
28
+ private final Optional <String > inferenceKey ;
29
+ private final Optional <String > inferenceAddress ;
30
+ private final Optional <Integer > inferencePort ;
31
31
32
- private Optional <String > managementKey ;
33
- private Optional <String > managementAddress ;
34
- private Optional <Integer > managementPort ;
32
+ private final Optional <String > managementKey ;
33
+ private final Optional <String > managementAddress ;
34
+ private final Optional <Integer > managementPort ;
35
35
36
- private Optional <String > metricsAddress ;
37
- private Optional <Integer > metricsPort ;
36
+ private final Optional <String > metricsAddress ;
37
+ private final Optional <Integer > metricsPort ;
38
38
39
39
private Configuration () {
40
40
Properties props = loadProperties ();
41
41
42
42
this .inferenceKey = loadProperty (INFERENCE_KEY , props );
43
43
this .inferenceAddress = loadProperty (INFERENCE_ADDRESS , props );
44
44
this .inferencePort = loadProperty (INFERENCE_PORT , props ).map (Integer ::parseInt );
45
+
45
46
this .managementKey = loadProperty (MANAGEMENT_KEY , props );
46
47
this .managementAddress = loadProperty (MANAGEMENT_ADDRESS , props );
47
48
this .managementPort = loadProperty (MANAGEMENT_PORT , props ).map (Integer ::parseInt );
49
+
48
50
this .metricsAddress = loadProperty (METRICS_ADDRESS , props );
49
51
this .metricsPort = loadProperty (METRICS_PORT , props ).map (Integer ::parseInt );
50
52
}
@@ -66,9 +68,11 @@ static Properties loadProperties() {
66
68
*/
67
69
static Optional <String > loadProperty (String key , Properties properties ) {
68
70
String tsc4jKey = TSC4J_PREFIX + key ;
69
- return Optional .ofNullable (System .getProperty (tsc4jKey ))
71
+ Optional < String > value = Optional .ofNullable (System .getProperty (tsc4jKey ))
70
72
.or (() -> Optional .ofNullable (System .getenv (tsc4jKey .toUpperCase ().replace ("." , "_" ))))
71
73
.or (() -> Optional .ofNullable (properties .getProperty (key )));
74
+ LOG .debug ("Loaded property {}: {}" , key , value .orElse (null ));
75
+ return value ;
72
76
}
73
77
74
78
public static Configuration load () {
0 commit comments