Skip to content
Snippets Groups Projects
Commit e88b41aa authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Default value for 'enable.full.bucket.name' = false.

Added debug logs.
parent 40a09f7f
No related branches found
No related tags found
1 merge request!46Unique bucket name across GCP (GONRG-701)
Pipeline #10296 passed
...@@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; ...@@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class StorageReaderFactoryImpl implements IStorageReaderFactory { public class StorageReaderFactoryImpl implements IStorageReaderFactory {
@Value("#{new Boolean('${enable.full.bucket.name}')}") @Value("#{new Boolean('${enable.full.bucket.name:false}')}")
private Boolean isFullBucketName; private Boolean isFullBucketName;
@Override @Override
......
...@@ -8,6 +8,4 @@ server.port=8080 ...@@ -8,6 +8,4 @@ server.port=8080
JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M
JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45 JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45
enable.full.bucket.name=${ENABLE_FULL_BUCKET_NAME} enable.full.bucket.name=false
\ No newline at end of file
package org.opengroup.osdu.legal.util; package org.opengroup.osdu.legal.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import com.google.api.client.util.Strings; import com.google.api.client.util.Strings;
import com.google.auth.oauth2.GoogleCredentials; import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.storage.BlobId; import com.google.cloud.storage.BlobId;
...@@ -12,7 +7,10 @@ import com.google.cloud.storage.BlobInfo; ...@@ -12,7 +7,10 @@ import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.Storage; import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions; import com.google.cloud.storage.StorageOptions;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.util.Objects; import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import lombok.extern.java.Log; import lombok.extern.java.Log;
@Log @Log
...@@ -47,12 +45,22 @@ public class GCPLegalTagUtils extends LegalTagUtils { ...@@ -47,12 +45,22 @@ public class GCPLegalTagUtils extends LegalTagUtils {
String projectName = System.getProperty("GCLOUD_PROJECT", System.getenv("GCLOUD_PROJECT")) String projectName = System.getProperty("GCLOUD_PROJECT", System.getenv("GCLOUD_PROJECT"))
.toLowerCase(); .toLowerCase();
String enableFullBucketName = System.getProperty("ENABLE_FULL_BUCKET_NAME", String enableFullBucketName = System.getProperty("ENABLE_FULL_BUCKET_NAME",
System.getenv("ENABLE_FULL_BUCKET_NAME")).toLowerCase(); System.getenv("ENABLE_FULL_BUCKET_NAME"));
enableFullBucketName = (Strings.isNullOrEmpty(enableFullBucketName) ? "false"
: enableFullBucketName).toLowerCase();
log.info("ENABLE_FULL_BUCKET_NAME = " + enableFullBucketName); log.info("ENABLE_FULL_BUCKET_NAME = " + enableFullBucketName);
if (Objects.nonNull(enableFullBucketName) && Boolean.valueOf(enableFullBucketName)) {
return projectName + "-" + tenantName + "-" + BUCKET_NAME; String bucketName;
if (Boolean.parseBoolean(enableFullBucketName)) {
bucketName = projectName + "-" + tenantName + "-" + BUCKET_NAME;
} else {
bucketName = tenantName + "-" + BUCKET_NAME;
} }
return tenantName + "-" + BUCKET_NAME;
log.info("bucketName = " + bucketName);
return bucketName;
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment