Commit 13e88f8f authored by Erik Leckner's avatar Erik Leckner
Browse files

file-azure

parent 0a3205c8
Pipeline #6123 passed with stage
in 4 minutes and 43 seconds
...@@ -44,14 +44,10 @@ public class StorageRepository implements IStorageRepository { ...@@ -44,14 +44,10 @@ public class StorageRepository implements IStorageRepository {
@Inject @Inject
final Storage storage; final Storage storage;
@Value("${azure.storage.account}") private String storageAccount = getStorageAccount();
private static String azureStorageAccount;
private String storageAccount;
public StorageRepository(Storage storage) { public StorageRepository(Storage storage) {
this.storage = storage; this.storage = storage;
this.storageAccount = getStorageAccount();
} }
@Override @Override
...@@ -62,7 +58,7 @@ public class StorageRepository implements IStorageRepository { ...@@ -62,7 +58,7 @@ public class StorageRepository implements IStorageRepository {
.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE) .setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE)
.build(); .build();
Blob blob = storage.create(blobInfo, ArrayUtils.EMPTY_BYTE_ARRAY); Blob blob = storage.create(blobInfo, ArrayUtils.EMPTY_BYTE_ARRAY);
log.debug("Created the blob in container {} for path {}", containerName, filepath); log.debug("Created the blob in container {} for path {}", containerName, filepath);
System.out.println(String.format("Created the blob in container %s for path %s", containerName, filepath)); System.out.println(String.format("Created the blob in container %s for path %s", containerName, filepath));
URL signedUrl = storage.signUrl(blobInfo, 7L, TimeUnit.DAYS); URL signedUrl = storage.signUrl(blobInfo, 7L, TimeUnit.DAYS);
log.debug("Signed URL for created storage object. Object ID : {} , Signed URL : {}", log.debug("Signed URL for created storage object. Object ID : {} , Signed URL : {}",
...@@ -74,7 +70,7 @@ public class StorageRepository implements IStorageRepository { ...@@ -74,7 +70,7 @@ public class StorageRepository implements IStorageRepository {
} }
public static String getStorageAccount() { public static String getStorageAccount() {
return azureStorageAccount; return System.getProperty("AZURE_STORAGE_ACCOUNT", System.getenv("AZURE_STORAGE_ACCOUNT"));
} }
private URI getObjectUri(Blob blob) { private URI getObjectUri(Blob blob) {
......
...@@ -97,10 +97,10 @@ public class StorageImpl implements Storage { ...@@ -97,10 +97,10 @@ public class StorageImpl implements Storage {
return null; return null;
} }
@SneakyThrows @SneakyThrows
@Override @Override
public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit timeUnit) { public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit timeUnit) {
URL url = null;
try { try {
log.debug("Signing the blob in container {} for path {}", blobInfo.getContainer(), blobInfo.getName()); log.debug("Signing the blob in container {} for path {}", blobInfo.getContainer(), blobInfo.getName());
System.out.println(String.format("Signing the blob in container %s for path %s", blobInfo.getContainer(), blobInfo.getName())); System.out.println(String.format("Signing the blob in container %s for path %s", blobInfo.getContainer(), blobInfo.getName()));
......
...@@ -23,8 +23,8 @@ azure.cosmosdb.database=${cosmosdb_database} ...@@ -23,8 +23,8 @@ azure.cosmosdb.database=${cosmosdb_database}
azure.keyvault.url=${keyvault_url} azure.keyvault.url=${keyvault_url}
# Azure Blob Storage configuration # Azure Blob Storage configuration
file.location.containerName=odes-os-file-temp file.location.containerName=osdu-container
file.location.userId=common-user file.location.userId=osdu-user
azure.storage.account=${AZURE_STORAGE_ACCOUNT} azure.storage.account=${AZURE_STORAGE_ACCOUNT}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment