From 64d3f0446902311b445037ff0215df3d8137a321 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 6 Jul 2021 14:02:51 +0300 Subject: [PATCH] Add additional application configuration to magix server --- .../src/main/kotlin/ru/mipt/npm/magix/server/server.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/magix/magix-server/src/main/kotlin/ru/mipt/npm/magix/server/server.kt b/magix/magix-server/src/main/kotlin/ru/mipt/npm/magix/server/server.kt index cf0d98a..dddb0cf 100644 --- a/magix/magix-server/src/main/kotlin/ru/mipt/npm/magix/server/server.kt +++ b/magix/magix-server/src/main/kotlin/ru/mipt/npm/magix/server/server.kt @@ -1,5 +1,6 @@ package ru.mipt.npm.magix.server +import io.ktor.application.Application import io.ktor.network.selector.ActorSelectorManager import io.ktor.network.sockets.aSocket import io.ktor.server.cio.CIO @@ -33,12 +34,14 @@ public fun CoroutineScope.launchMagixServerRawRSocket( /** * A combined RSocket/TCP server + * @param applicationConfiguration optional additional configuration for magix loop server */ public fun CoroutineScope.startMagixServer( port: Int = DEFAULT_MAGIX_HTTP_PORT, buffer: Int = 100, enableRawRSocket: Boolean = true, - enableZmq: Boolean = true + enableZmq: Boolean = true, + applicationConfiguration: Application.(MutableSharedFlow) -> Unit = {} ): ApplicationEngine { val logger = LoggerFactory.getLogger("magix-server") val magixFlow = MutableSharedFlow( @@ -66,6 +69,7 @@ public fun CoroutineScope.startMagixServer( return embeddedServer(CIO, host = "localhost", port = port) { magixModule(magixFlow) + applicationConfiguration(magixFlow) }.apply { start() }