Skip to content

Support finding applicationinsights.json in current dir when using runtime attach#3990

Merged
trask merged 7 commits into
mainfrom
runtime-attach-curr-dir
Jan 9, 2025
Merged

Support finding applicationinsights.json in current dir when using runtime attach#3990
trask merged 7 commits into
mainfrom
runtime-attach-curr-dir

Conversation

@trask

@trask trask commented Dec 19, 2024

Copy link
Copy Markdown
Member

Resolves #3989

@jeanbisutti

Copy link
Copy Markdown
Contributor

Spring Boot can also retrieve configuration files in the /config subdirectory of the current directory: https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files

The Application Insights json file could also be retrieved from this subdirectory.

try {
return Files.newInputStream(defaultFile.toPath());
} catch (IOException e) {
throw new IllegalStateException(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try {
Optional<String> jsonConfig = findJsonConfig();
Optional<String> jsonConfig = findJsonConfigFromClasspath();
if (!jsonConfig.isPresent()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's assume the user adds a JSON configuration file in src/main/resources and creates a Spring Boot executable JAR.

The user may want to use a configuration different from the default one in the classpath without creating a new JAR file.

It may be useful to check the configuration from the file system first.

@trask trask merged commit e01bd32 into main Jan 9, 2025
@trask trask deleted the runtime-attach-curr-dir branch January 9, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support for Loading applicationinsights.json from Current Working Directory (CWD)

2 participants