make media folder root path customisable

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