-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
README_API_KEY is red from env.var, fetching headers info and readin …
…user data from it
- Loading branch information
Serhii Vydiuk
committed
Dec 11, 2024
1 parent
925639f
commit febcd8b
Showing
26 changed files
with
473 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/java/examples/OwlTestApp/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
readme: | ||
readmeApiKey: ${README_API_KEY} | ||
userdata: | ||
apiKey: | ||
source: header | ||
fieldName: X-User-Name | ||
email: | ||
source: header | ||
fieldName: X-User-Email | ||
label: | ||
source: header | ||
fieldName: X-User-Id |
13 changes: 0 additions & 13 deletions
13
...es/java/examples/OwlTestApp/src/test/java/com/readme/example/ExampleApplicationTests.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...boot-starter/src/main/java/com/readme/starter/config/DataCollectionAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.readme.starter.config; | ||
|
||
import com.readme.dataextraction.RequestDataCollector; | ||
import com.readme.dataextraction.UserDataCollector; | ||
import com.readme.starter.datacollection.DataCollectionFilter; | ||
import com.readme.starter.datacollection.ServletDataPayloadAdapter; | ||
import lombok.AllArgsConstructor; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.Ordered; | ||
|
||
/** | ||
* Configuration class for registering and initializing the JakartaDataCollectionFilter | ||
* along with its dependencies in a Spring Boot application. | ||
* <p> | ||
* This configuration provides the following: | ||
* <ul> | ||
* <li>Instantiates the {@link DataCollectionFilter} with required collectors.</li> | ||
* <li>Registers the filter using {@link FilterRegistrationBean} for servlet-based applications.</li> | ||
* <li>Sets up default implementations for collecting request and user data.</li> | ||
* </ul> | ||
*/ | ||
@Configuration | ||
@ConditionalOnClass({UserDataProperties.class}) | ||
@ComponentScan(basePackages = {"com.readme.starter"}) | ||
@AllArgsConstructor | ||
public class DataCollectionAutoConfiguration { | ||
|
||
@Bean | ||
public FilterRegistrationBean<DataCollectionFilter> metricsFilter( | ||
RequestDataCollector<ServletDataPayloadAdapter> requestDataCollector, | ||
UserDataCollector<ServletDataPayloadAdapter> userDataCollector) { | ||
FilterRegistrationBean<DataCollectionFilter> registrationBean = new FilterRegistrationBean<>(); | ||
registrationBean.setFilter(new DataCollectionFilter(requestDataCollector, userDataCollector)); | ||
registrationBean.setOrder(Ordered.HIGHEST_PRECEDENCE); | ||
registrationBean.addUrlPatterns("/*"); | ||
return registrationBean; | ||
} | ||
|
||
} |
70 changes: 0 additions & 70 deletions
70
...ing-boot-starter/src/main/java/com/readme/starter/config/JakartaDataCollectionConfig.java
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
...g-boot-starter/src/main/java/com/readme/starter/config/ReadmeConfigurationProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.readme.starter.config; | ||
|
||
import lombok.Data; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Data | ||
@Component | ||
@ConfigurationProperties(prefix = "readme") | ||
public class ReadmeConfigurationProperties { | ||
|
||
private String readmeApiKey; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
...-boot-starter/src/main/java/com/readme/starter/datacollection/HttpServletDataPayload.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.