make media folder root path customisable

parent 6532ade9
Pipeline #18427 passed with stages
in 7 minutes and 25 seconds
...@@ -61,6 +61,8 @@ spec: ...@@ -61,6 +61,8 @@ spec:
value: fedora-output-json-records value: fedora-output-json-records
- name: TOPIC_PROCESS - name: TOPIC_PROCESS
value: postprocessing-reporting value: postprocessing-reporting
- name: MEDIA_FOLDER_ROOT_PATH
value: "/data"
restartPolicy: Always restartPolicy: Always
volumes: volumes:
......
...@@ -4,6 +4,7 @@ app: ...@@ -4,6 +4,7 @@ app:
externalBaseUrl: ${EXTERNAL_BASE_URL:?system} externalBaseUrl: ${EXTERNAL_BASE_URL:?system}
fedoraUser: ${FEDORA_USER:?system} fedoraUser: ${FEDORA_USER:?system}
fedoraPassword: ${FEDORA_PASSWORD:?system} fedoraPassword: ${FEDORA_PASSWORD:?system}
mediaFolderRootPath: ${MEDIA_FOLDER_ROOT_PATH:?system}
kafka: kafka:
consumer: consumer:
bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:?system} bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:?system}
......
...@@ -35,7 +35,8 @@ object App extends scala.App with Logging with RecordUtils { ...@@ -35,7 +35,8 @@ object App extends scala.App with Logging with RecordUtils {
"internalBaseUrl", "internalBaseUrl",
"externalBaseUrl", "externalBaseUrl",
"fedoraUser", "fedoraUser",
"fedoraPassword" "fedoraPassword",
"mediaFolderRootPath"
).asJava, ).asJava,
"app.yml", "app.yml",
true, true,
......
...@@ -21,11 +21,11 @@ package ch.memobase ...@@ -21,11 +21,11 @@ package ch.memobase
import ch.memobase.models.MimeType import ch.memobase.models.MimeType
object FileUtils { trait FileUtils {
import models.Conversions._ import models.Conversions._
val rootPath = "/data" val rootPath: String
val videoFilePath: (String, MimeType) => String = val videoFilePath: (String, MimeType) => String =
(id, mimeType) => s"$rootPath/$id.${getFileTypeExtension(mimeType).get}" (id, mimeType) => s"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
......
...@@ -41,9 +41,9 @@ case class ProcessIgnore(id: String, msg: String) extends ProcessOutcome ...@@ -41,9 +41,9 @@ case class ProcessIgnore(id: String, msg: String) extends ProcessOutcome
class RecordProcessor(fileHandler: DisseminationCopyHandler, class RecordProcessor(fileHandler: DisseminationCopyHandler,
fedoraClientWrapper: FedoraClientWrapper, fedoraClientWrapper: FedoraClientWrapper,
appSettings: Properties) { appSettings: Properties) extends FileUtils {
import FileUtils._ val rootPath: String = appSettings.getProperty("mediaFolderRootPath")
def process(record: ConsumerRecord[String, String]): List[ProcessOutcome] = { def process(record: ConsumerRecord[String, String]): List[ProcessOutcome] = {
BinaryResourceMetadata.build(record.value(), appSettings.getProperty("externalBaseUrl")) flatMap { BinaryResourceMetadata.build(record.value(), appSettings.getProperty("externalBaseUrl")) flatMap {
......
Markdown is supported
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