From f730ac75006fc11f5493c1f5d378b71a0e4d1288 Mon Sep 17 00:00:00 2001 From: xis Date: Mon, 9 Oct 2023 16:54:29 +0200 Subject: [PATCH] env variables pass to config --- .../net/schowek/nextclouddlna/NextcloudDLNA.kt | 4 +++- .../dlna/transport/MyHttpExchangeUpnpStream.kt | 2 +- .../nextcloud/NextcloudConfigDiscovery.kt | 3 ++- src/main/resources/application.yml | 15 +++++++-------- .../nextclouddlna/NextcloudDLNAAppTests.kt | 13 ------------- 5 files changed, 13 insertions(+), 24 deletions(-) delete mode 100644 src/test/kotlin/net/schowek/nextclouddlna/NextcloudDLNAAppTests.kt diff --git a/src/main/kotlin/net/schowek/nextclouddlna/NextcloudDLNA.kt b/src/main/kotlin/net/schowek/nextclouddlna/NextcloudDLNA.kt index baa144e..0ad6e19 100644 --- a/src/main/kotlin/net/schowek/nextclouddlna/NextcloudDLNA.kt +++ b/src/main/kotlin/net/schowek/nextclouddlna/NextcloudDLNA.kt @@ -7,7 +7,9 @@ import org.springframework.stereotype.Component @Component -class NextcloudDLNA(private val dlnaService: DlnaService) { +class NextcloudDLNA( + private val dlnaService: DlnaService +) { private val upnpService: UpnpService = dlnaService.start() @PreDestroy diff --git a/src/main/kotlin/net/schowek/nextclouddlna/dlna/transport/MyHttpExchangeUpnpStream.kt b/src/main/kotlin/net/schowek/nextclouddlna/dlna/transport/MyHttpExchangeUpnpStream.kt index 81d9f4e..43330a9 100644 --- a/src/main/kotlin/net/schowek/nextclouddlna/dlna/transport/MyHttpExchangeUpnpStream.kt +++ b/src/main/kotlin/net/schowek/nextclouddlna/dlna/transport/MyHttpExchangeUpnpStream.kt @@ -60,7 +60,7 @@ abstract class MyHttpExchangeUpnpStream( logger.debug("Request did not contain entity body") } if (bodyBytes.isNotEmpty()) { - logger.info(" Request body: " + requestMessage.body) + logger.debug(" Request body: " + requestMessage.body) } val responseMessage = process(requestMessage) diff --git a/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/NextcloudConfigDiscovery.kt b/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/NextcloudConfigDiscovery.kt index ac18ee5..17a3a43 100644 --- a/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/NextcloudConfigDiscovery.kt +++ b/src/main/kotlin/net/schowek/nextclouddlna/nextcloud/NextcloudConfigDiscovery.kt @@ -12,7 +12,8 @@ import java.util.Objects.* @Component class NextcloudConfigDiscovery( - @Value("\${nextcloud.filesDir}") val nextcloudDir: String, + @Value("\${nextcloud.filesDir}") + val nextcloudDir: String, val appConfigRepository: AppConfigRepository ) { final var logger = LoggerFactory.getLogger(NextcloudConfigDiscovery::class.java) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9945a90..852ab82 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,18 +1,17 @@ server: - port: 8080 - interface: eth0 - friendlyName: NC-DLNA! + port: ${NEXTCLOUD_DLNA_SERVER_PORT:8080} + interface: ${NEXTCLOUD_DLNA_INTERFACE:eth0} + friendlyName: ${NEXTCLOUD_DLNA_FRIENDLY_NAME:Nextcloud-DLNA} nextcloud: - filesDir: /path/to/your/nextcloud/dir/ending/with/data + filesDir: ${NEXTCLOUD_DATA_DIR:/path/to/your/nextcloud/dir/ending/with/data} spring: datasource: - url: jdbc:mariadb://localhost:3306/nextcloud - username: nextcloud - password: nextcloud + url: "jdbc:mariadb://${NEXTCLOUD_DB_HOST:localhost}:${NEXTCLOUD_DB_PORT:3306}/${NEXTCLOUD_DB_NAME:nextcloud}" + username: ${NEXTCLOUD_DB_USER:nextcloud} + password: ${NEXTCLOUD_DB_PASS:nextcloud} driver-class-name: org.mariadb.jdbc.Driver jpa: hibernate: ddl-auto: none - diff --git a/src/test/kotlin/net/schowek/nextclouddlna/NextcloudDLNAAppTests.kt b/src/test/kotlin/net/schowek/nextclouddlna/NextcloudDLNAAppTests.kt deleted file mode 100644 index 1889277..0000000 --- a/src/test/kotlin/net/schowek/nextclouddlna/NextcloudDLNAAppTests.kt +++ /dev/null @@ -1,13 +0,0 @@ -package net.schowek.nextclouddlna - -import org.junit.jupiter.api.Test -import org.springframework.boot.test.context.SpringBootTest - -@SpringBootTest -class NextcloudDLNAAppTests { - - @Test - fun contextLoads() { - } - -}