|
21 | 21 |
|
22 | 22 | package com.microsoft.applicationinsights.agent.internal.wasbootstrap.configuration; |
23 | 23 |
|
| 24 | +import java.io.File; |
24 | 25 | import java.io.IOException; |
25 | 26 | import java.io.InputStream; |
26 | | -import java.lang.reflect.Type; |
27 | 27 | import java.nio.file.Files; |
28 | 28 | import java.nio.file.Path; |
29 | 29 | import java.nio.file.attribute.BasicFileAttributes; |
30 | | -import java.util.List; |
31 | | -import java.util.Locale; |
32 | | -import java.util.concurrent.CopyOnWriteArrayList; |
33 | | - |
34 | | -import com.microsoft.applicationinsights.agent.internal.wasbootstrap.configuration.Configuration.JmxMetric; |
35 | | -import com.microsoft.applicationinsights.customExceptions.FriendlyException; |
36 | 30 | import com.squareup.moshi.JsonAdapter; |
37 | | -import com.squareup.moshi.JsonDataException; |
38 | | -import com.squareup.moshi.JsonEncodingException; |
39 | | -import com.squareup.moshi.JsonReader; |
40 | 31 | import com.squareup.moshi.Moshi; |
41 | | -import com.squareup.moshi.Types; |
42 | 32 | import okio.Buffer; |
43 | | -import org.slf4j.Logger; |
44 | | -import org.slf4j.LoggerFactory; |
45 | 33 |
|
46 | 34 | public class RpConfigurationBuilder { |
47 | 35 |
|
| 36 | + private static final String APPLICATIONINSIGHTS_RP_CONFIGURATION_FILE = "APPLICATIONINSIGHTS_RP_CONFIGURATION_FILE"; |
| 37 | + |
48 | 38 | public static RpConfiguration create(Path agentJarPath) throws IOException { |
49 | | - Path configPath = agentJarPath.resolveSibling("applicationinsights-rp.json"); |
| 39 | + Path configPath; |
| 40 | + String configPathString = ConfigurationBuilder.getEnvVar(APPLICATIONINSIGHTS_RP_CONFIGURATION_FILE); |
| 41 | + |
| 42 | + if (configPathString != null) { |
| 43 | + configPath = new File(configPathString).toPath(); |
| 44 | + } else { |
| 45 | + configPath = agentJarPath.resolveSibling("applicationinsights-rp.json"); |
| 46 | + } |
| 47 | + |
50 | 48 | if (Files.exists(configPath)) { |
51 | 49 | return loadJsonConfigFile(configPath); |
52 | 50 | } |
|
0 commit comments