Skip to content

Commit

Permalink
Add S3 Path delimiter varaible in config
Browse files Browse the repository at this point in the history
Signed-off-by: Dinu John <[email protected]>
  • Loading branch information
dinujoh committed Apr 22, 2024
1 parent 128c866 commit 8dfae0d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class MongoDBSourceConfig {
private static final String DATAPREPPER_SERVICE_NAME = "DATAPREPPER_SERVICE_NAME";

private static final long currentTimeInEpochMilli = Instant.now().toEpochMilli();
public static final String S3_PATH_DELIMITER = "/";
@JsonProperty("hosts")
private @NotNull String[] hosts;
@JsonProperty("port")
Expand Down Expand Up @@ -132,11 +133,11 @@ public String getS3Prefix() {

public String getTransformedS3PathPrefix(final String collection) {
final String serviceName = System.getenv(DATAPREPPER_SERVICE_NAME);
final String suffixPath = serviceName + "/" + collection + "/" + currentTimeInEpochMilli;
final String suffixPath = serviceName + S3_PATH_DELIMITER + collection + S3_PATH_DELIMITER + currentTimeInEpochMilli;
if (this.getS3Prefix() == null || this.getS3Prefix().trim().isBlank()) {
return suffixPath;
} else {
return this.s3Prefix + "/" + suffixPath;
return this.s3Prefix + S3_PATH_DELIMITER + suffixPath;
}
}

Expand Down

0 comments on commit 8dfae0d

Please sign in to comment.