Commit 1a256a79 authored by Kartheek Palla's avatar Kartheek Palla
Browse files

Issue #IQ-45 feat: CSP changes

Showing with 12 additions and 29 deletions
+12 -29
......@@ -18,37 +18,20 @@ class StorageService {
@throws[Exception]
def getService: BaseStorageService = {
if (null == storageService) {
if (StringUtils.equalsIgnoreCase(storageType, "azure")) {
val storageKey = Platform.config.getString("azure_storage_key")
val storageSecret = Platform.config.getString("azure_storage_secret")
storageService = StorageServiceFactory.getStorageService(StorageConfig(storageType, storageKey, storageSecret))
} else if (StringUtils.equalsIgnoreCase(storageType, "aws")) {
val storageKey = Platform.config.getString("aws_storage_key")
val storageSecret = Platform.config.getString("aws_storage_secret")
storageService = StorageServiceFactory.getStorageService(StorageConfig(storageType, storageKey, storageSecret))
} else if (StringUtils.equalsIgnoreCase(storageType, "gcloud")) {
val storageKey = Platform.config.getString("gcloud_client_key")
val storageSecret = Platform.config.getString("gcloud_private_secret")
storageService = StorageServiceFactory.getStorageService(StorageConfig(storageType, storageKey, storageSecret))
}
// else if (StringUtils.equalsIgnoreCase(storageType, "cephs3")) {
// val storageKey = Platform.config.getString("cephs3_storage_key")
// val storageSecret = Platform.config.getString("cephs3_storage_secret")
// val endpoint = Platform.config.getString("cephs3_storage_endpoint")
// storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret, Option(endpoint)))
// }
else throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Error while initialising cloud storage")
val storageKey = Platform.config.getString("cloud_storage_key")
val storageSecret = Platform.config.getString("cloud_storage_secret")
// TODO: endPoint defined to support "cephs3". Make code changes after cloud-store-sdk 2.11 support it.
val endPoint = if (Platform.config.hasPath("cloud_storage_endpoint")) Option(Platform.config.getString("cloud_storage_endpoint")) else None
storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret))
}
storageService
}
def getContainerName: String = {
storageType match {
case "azure" => Platform.config.getString("azure_storage_container")
case "aws" => Platform.config.getString("aws_storage_container")
case "gcloud" => Platform.config.getString("gcloud_storage_bucket")
case _ => throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Container name not configured.")
}
if(Platform.config.hasPath("cloud_storage_container"))
Platform.config.getString("cloud_storage_container")
else
throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Cloud Storage Container name not configured.")
}
def uploadFile(folderName: String, file: File, slug: Option[Boolean] = Option(true)): Array[String] = {
......
......@@ -473,9 +473,9 @@ content.h5p.library.path="https://s3.ap-south-1.amazonaws.com/ekstep-public-dev/
# This is added to handle large artifacts sizes differently
content.artifact.size.for_online=209715200
cloud_storage_type="azure"
azure_storage_key="asdfgh"
azure_storage_secret="jhgfdcvb"
azure_storage_container="sunbird-content-dev"
cloud_storage_key="asdfgh"
cloud_storage_secret="jhgfdcvb"
cloud_storage_container="sunbird-content-dev"
validation.strictMimeType = ["image/svg+xml"]
......
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