Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
knowledge-platform
Commits
1a256a79
Commit
1a256a79
authored
2 years ago
by
Kartheek Palla
Browse files
Options
Download
Patches
Plain Diff
Issue #IQ-45 feat: CSP changes
parent
760d7baf
release-5.3.0
csp-migration
knowlg-oneclick
local-setup-kube
patch-1
patch-2
patch-3
release-5.2.0
release-5.2.0_RC2
release-5.2.0_RC1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala
+9
-26
...rc/main/scala/org/sunbird/cloudstore/StorageService.scala
platform-modules/mimetype-manager/src/test/resources/application.conf
+3
-3
...ules/mimetype-manager/src/test/resources/application.conf
with
12 additions
and
29 deletions
+12
-29
platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala
+
9
−
26
View file @
1a256a79
...
...
@@ -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
]
=
{
...
...
This diff is collapsed.
Click to expand it.
platform-modules/mimetype-manager/src/test/resources/application.conf
+
3
−
3
View file @
1a256a79
...
...
@@ -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"
]
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets