In order to mitigate against the brute force attacks against Gitlab accounts, we are moving to all edu-ID Logins. We would like to remind you to link your account with your edu-id. Login will be possible only by edu-ID after November 30, 2021. Here you can find the instructions for linking your account.

If you don't have a SWITCH edu-ID, you can create one with this guide here

kind regards

This Server has been upgraded to GitLab release 14.2.6

Unverified Commit fb686f24 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

remove data path settings

parent fd1785c1
Pipeline #15096 passed with stages
in 13 minutes and 19 seconds
......@@ -26,12 +26,6 @@ spec:
env:
- name: JOB_ID
value: media-converter
- name: AUDIO_SINK_DIR
value: /data
- name: IMAGE_SINK_DIR
value: /data
- name: VIDEO_SINK_DIR
value: /data
- name: AUDIO_SNIPPET_DURATION
value: "30"
- name: INTERNAL_BASE_URL
......
app:
audioSinkDir: ${AUDIO_SINK_DIR:?system}
imageSinkDir: ${IMAGE_SINK_DIR:?system}
videoSinkDir: ${VIDEO_SINK_DIR:?system}
audioSnippetDuration: ${AUDIO_SNIPPET_DURATION:?system}
internalBaseUrl: ${INTERNAL_BASE_URL:?system}
externalBaseUrl: ${EXTERNAL_BASE_URL:?system}
......
......@@ -31,9 +31,6 @@ import scala.collection.JavaConverters._
object App extends scala.App with Logging {
val settings = new SettingsLoader(List(
"audioSinkDir",
"imageSinkDir",
"videoSinkDir",
"audioSnippetDuration",
"internalBaseUrl",
"externalBaseUrl",
......@@ -47,9 +44,6 @@ object App extends scala.App with Logging {
false)
val consumer = new KafkaConsumer[String, String](settings.getKafkaConsumerSettings)
val fileHandler = new DisseminationCopyHandler(
settings.getAppSettings.getProperty("audioSinkDir"),
settings.getAppSettings.getProperty("imageSinkDir"),
settings.getAppSettings.getProperty("videoSinkDir"),
settings.getAppSettings.getProperty("audioSnippetDuration").toInt)
val fCWrapper = FedoraClientWrapper(
settings.getAppSettings.getProperty("internalBaseUrl"),
......
......@@ -28,12 +28,8 @@ import scala.util.{Failure, Success, Try}
/**
* Manages dissemination copies of media files
*
* @param audioDestPath Path to folder containing audio dissemination copies
* @param imageDestPath Path to folder containing image dissemination copies
* @param videoDestPath Path to folder containing video dissemination copies
*/
class DisseminationCopyHandler(audioDestPath: String, imageDestPath: String, videoDestPath: String, audioSnippetDuration: Int) {
class DisseminationCopyHandler(audioSnippetDuration: Int) {
private def writeData(data: ByteArrayOutputStream, destFile: Path): Try[Path] = {
Try(new FileOutputStream(destFile.toFile)) match {
......
......@@ -25,7 +25,7 @@ object FileUtils {
import models.Conversions._
val rootPath = "/media"
val rootPath = "/data"
def createVideoFile(id: String, mimeType: MimeType): String =
s"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
......
......@@ -20,12 +20,12 @@
package ch.memobase
import java.io.{ByteArrayOutputStream, File, FileInputStream}
import java.nio.file.{Files, Path, Paths}
import java.nio.file.{Files, Paths}
import ch.memobase.TestUtilities._
import ch.memobase.models.{JpegFile, MimeType, Mp3File, VideoMpeg4File}
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.{Assertion, BeforeAndAfter}
import TestUtilities._
import scala.util.Try
......@@ -34,7 +34,7 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter {
private def fixture = {
new {
val resPath = "src/test/resources"
val fileHandler = new DisseminationCopyHandler(resPath, resPath, resPath, 30)
val fileHandler = new DisseminationCopyHandler(30)
}
}
......@@ -67,12 +67,12 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter {
}
private def testAudioCopy(pathToTmpDir: String,
sourceFileName: String,
destFileName: String,
fileType: MimeType,
isSnippet: Boolean,
copyFun: (ByteArrayOutputStream, String, MimeType, Boolean)
=> Try[Boolean]): Assertion = {
sourceFileName: String,
destFileName: String,
fileType: MimeType,
isSnippet: Boolean,
copyFun: (ByteArrayOutputStream, String, MimeType, Boolean)
=> Try[Boolean]): Assertion = {
val file = Paths.get(pathToTmpDir, sourceFileName).toFile
val data = new ByteArrayOutputStream(file.length().toInt)
val buffer = new Array[Byte](1024)
......
......@@ -28,7 +28,6 @@ import org.scalamock.scalatest.MockFactory
import org.scalatest.funsuite.AnyFunSuite
import scala.io.Source
import scala.util.Success
class RecordProcessorTest extends AnyFunSuite with MockFactory {
......
......@@ -19,8 +19,6 @@
package ch.memobase
import org.scalatest.Assertion
import scala.language.postfixOps
object TestUtilities {
......
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