Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions content-api/content-service/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,11 @@ cloud_storage_container=""
cloud_storage_endpoint=""
cloud_storage_dial_container=""

#GCP Specific Credentials
cloud_storage_client_id=""
cloud_storage_private_key_id=""
cloud_storage_project_id=""

cloudstorage.metadata.replace_absolute_path=false
cloudstorage.relative_path_prefix= "CONTENT_STORAGE_BASE_PATH"
cloudstorage.read_base_path="https://sunbirddev.blob.core.windows.net"
Expand Down
10 changes: 10 additions & 0 deletions platform-modules/mimetype-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@
<artifactId>commons-validator</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.35.2</version>
</dependency>
<dependency>
<groupId>org.sunbird</groupId>
<artifactId>url-manager</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ class StorageService {
}

def getSignedURL(key: String, ttl: Option[Int], permission: Option[String]): String = {
getService.getPutSignedURL(getContainerName, key, ttl, permission, Option.apply(getMimeType(key)))
if(storageType == "gcloud")
{
val additionalParams: Map[String, String] = Map("clientId" -> (if (Platform.config.hasPath("cloud_storage_client_id")) Platform.config.getString("cloud_storage_client_id") else ""),
"privateKeyIds" -> (if (Platform.config.hasPath("cloud_storage_private_key_id")) Platform.config.getString("cloud_storage_private_key_id") else ""),
"projectId" -> (if (Platform.config.hasPath("cloud_storage_project_id")) Platform.config.getString("cloud_storage_project_id") else ""),
"privateKeyPkcs8" -> (if (Platform.config.hasPath("cloud_storage_secret")) Platform.config.getString("cloud_storage_secret") else ""),
"clientEmail" -> (if (Platform.config.hasPath("cloud_storage_key")) Platform.config.getString("cloud_storage_key") else "")
)
getService.getPutSignedURL(getContainerName, key, ttl, permission, additionalParams = Option.apply(additionalParams))
}
else getService.getPutSignedURL(getContainerName, key, ttl, permission)
}

def getUri(key: String): String = {
Expand Down
19 changes: 1 addition & 18 deletions platform-modules/url-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-youtube</artifactId>
<version>v3-rev182-1.22.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
<version>v3-rev222-1.25.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
Expand All @@ -43,17 +37,6 @@
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev136-1.25.0</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.22.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down