Skip to content

Commit

Permalink
Custom endpoint URL
Browse files Browse the repository at this point in the history
  • Loading branch information
IvoMajic committed Jan 21, 2024
1 parent 14caf09 commit 032198d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public class MyApplication {
Configure the following properties in your `application.properties` file:

```properties
treblle.endpoint=<OPTIONAL_ENDPOINT_URL> # Default is https://rocknrolla.treblle.com
treblle.apiKey=<API_KEY>
treblle.projectId=<PROJECT_ID>
```
Expand All @@ -124,6 +125,7 @@ In case you are using the `application.yml` file:

```yaml
treblle:
endpoint: <OPTIONAL_ENDPOINT_URL> # Default is https://rocknrolla.treblle.com
api-key: <API_KEY>
project-id: <PROJECT_ID>
```
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.treblle</groupId>
<artifactId>treblle-spring-boot-starter</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>treblle-spring-boot-starter</name>
<description>Official Treblle Starter for Spring Boot</description>
<url>https://github.com/Treblle/treblle-spring</url>
Expand All @@ -15,7 +15,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>3.1.0</spring-boot.version>
<spring-boot.version>3.1.8</spring-boot.version>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@
@ConfigurationProperties(prefix = "treblle")
public class TreblleProperties {

private String endpoint;
private String apiKey;
private String projectId;
private List<String> urlPatterns = Collections.emptyList();
private List<String> maskingKeywords = Collections.emptyList();

public String getEndpoint() {
return endpoint;
}

public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}

public String getApiKey() {
return apiKey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void maskAndSendPayload(TrebllePayload payload, byte[] requestBody, byte[
final HttpEntity<TrebllePayload> requestEntity = new HttpEntity<>(payload, headers);

try {
restTemplate.postForEntity(TREBLLE_API_ENDPOINT, requestEntity, Void.class);
restTemplate.postForEntity(Optional.ofNullable(treblleProperties.getEndpoint()).orElse(TREBLLE_API_ENDPOINT), requestEntity, Void.class);
} catch (RestClientException exception) {
log.error("An error occurred while sending network request to Treblle.", exception);
}
Expand Down

0 comments on commit 032198d

Please sign in to comment.