Don't validate the JSON connection string if APPLICATIONINSIGHT__CONNECTION_STRING#3759
Don't validate the JSON connection string if APPLICATIONINSIGHT__CONNECTION_STRING#3759jeanbisutti wants to merge 1 commit into
Conversation
…_CONNECTION_STRING env var is used
| && !replacedConnectionString.startsWith("InstrumentationKey=") | ||
| && config.connectionString.equals(replacedConnectionString)) { | ||
| && config.connectionString.equals(replacedConnectionString) | ||
| && System.getenv(APPLICATIONINSIGHTS_CONNECTION_STRING_ENV) == null) { |
There was a problem hiding this comment.
maybe it's better to check env var before loading from the file?
It's not needed to load from the file when env var is present.
There was a problem hiding this comment.
To do this with a code that is easy to read, https://github.com/microsoft/ApplicationInsights-Java/blob/5481277381728dcbc985117da619e61225be2237/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/ConfigurationBuilder.java#L757C9-L757C39 should be called before loading from a file. It seems that it would require to change several lines of code and check carefully that it does not break anything. In this PR, I'd rather make the minimal change and be confident to not break something. An unecessary read from a file may not be a user issue.
|
this is replaced by #3794, thus closing. |
Because the connection string from the APPLICATIONINSIGHT__CONNECTION_STRING environment variable takes precedence over the connection string coming from the JSON file.
Fix #3707