Преглед на файлове

Merge branch 'master' of http://139.162.7.140:3000/herlanS_/ipphone-bridge

herlanS_ преди 3 години
родител
ревизия
10997d88fc
променени са 2 файла, в които са добавени 38 реда и са изтрити 1 реда
  1. 31 0
      docker-compose.yml
  2. 7 1
      src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/BridgeFIlter.kt

+ 31 - 0
docker-compose.yml

@@ -0,0 +1,31 @@
+version: "3.9"
+services:
+  bridge:
+    image: maven:3.8.1-jdk-8
+    container_name: bridge2
+    restart: always
+    environment:
+      - PORT=9091
+    labels:
+      - autoheal=true
+    working_dir: /usr/src/mymaven
+    volumes:
+      - ./ipphone-bridge:/usr/src/mymaven
+      - ./.m2:/root/.m2
+    ports:
+      - "9091:9091"
+    healthcheck:
+      test: ["CMD", "curl", "-f", "http://localhost:9091/actuator/health"]
+      interval: 10s
+      timeout: 10s
+      retries: 3
+      start_period: 60s
+    command: mvn spring-boot:run
+  autoheal:
+    image: willfarrell/autoheal
+    container_name: autoheal-bridge2
+    volumes:
+      - '/var/run/docker.sock:/var/run/docker.sock'
+    environment:
+      - AUTOHEAL_INTERVAL=10
+      - CURL_TIMEOUT=30

+ 7 - 1
src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/BridgeFIlter.kt

@@ -98,8 +98,14 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
                     if (req.contentType != null && req.contentType.toLowerCase().indexOf("multipart/form-data") > -1) {
                         rb.parts =
                             req.parts.map {
+                                val subFilename = if (it.submittedFileName == null) {
+                                    UUID.randomUUID().toString().take(5)
+                                } else {
+                                    it.submittedFileName
+                                }
+
                                 val fb64 = Base64.getEncoder().encodeToString(it.inputStream.readBytes())
-                                FilePart(it.name, it.submittedFileName, fb64)
+                                FilePart(it.name, subFilename, fb64)
                             }.toMutableList()
                     } else {
                         val body = req.reader.lines().toList().joinToString(System.lineSeparator())