Skip to content

Commit 11ba109

Browse files
committed
grpc: Fix Ktor server constructor
Signed-off-by: Johannes Zottele <[email protected]>
1 parent 89f1dee commit 11ba109

File tree

1 file changed

+6
-12
lines changed
  • grpc/grpc-ktor-server/src/commonMain/kotlin/kotlinx/rpc/grpc/ktor/server

1 file changed

+6
-12
lines changed

grpc/grpc-ktor-server/src/commonMain/kotlin/kotlinx/rpc/grpc/ktor/server/Server.kt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44

55
package kotlinx.rpc.grpc.ktor.server
66

7-
import io.ktor.server.application.Application
8-
import io.ktor.server.application.ApplicationStopped
9-
import io.ktor.server.application.ApplicationStopping
10-
import io.ktor.server.application.log
11-
import io.ktor.server.config.getAs
12-
import io.ktor.util.AttributeKey
7+
import io.ktor.server.application.*
8+
import io.ktor.server.config.*
9+
import io.ktor.util.*
1310
import kotlinx.rpc.RpcServer
1411
import kotlinx.rpc.grpc.GrpcServer
12+
import kotlinx.rpc.grpc.GrpcServerConfiguration
1513
import kotlinx.rpc.grpc.ServerBuilder
16-
import kotlinx.rpc.grpc.codec.EmptyMessageCodecResolver
17-
import kotlinx.rpc.grpc.codec.MessageCodecResolver
1814

1915
@Suppress("ConstPropertyName")
2016
public object GrpcConfigKeys {
@@ -51,8 +47,7 @@ public val GrpcServerKey: AttributeKey<GrpcServer> = AttributeKey<GrpcServer>("G
5147
*/
5248
public fun Application.grpc(
5349
port: Int = environment.config.propertyOrNull(GrpcConfigKeys.grpcHostPortPath)?.getAs<Int>() ?: 8001,
54-
messageCodecResolver: MessageCodecResolver = EmptyMessageCodecResolver,
55-
configure: ServerBuilder<*>.() -> Unit = {},
50+
configure: GrpcServerConfiguration.() -> Unit = {},
5651
builder: RpcServer.() -> Unit,
5752
): GrpcServer {
5853
if (attributes.contains(GrpcServerKey)) {
@@ -64,9 +59,8 @@ public fun Application.grpc(
6459
newServer = true
6560
GrpcServer(
6661
port = port,
67-
messageCodecResolver = messageCodecResolver,
6862
parentContext = coroutineContext,
69-
serverBuilder = configure,
63+
configure = configure,
7064
builder = builder,
7165
)
7266
}

0 commit comments

Comments
 (0)