4
4
5
5
package kotlinx.rpc.grpc.ktor.server
6
6
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.*
13
10
import kotlinx.rpc.RpcServer
14
11
import kotlinx.rpc.grpc.GrpcServer
12
+ import kotlinx.rpc.grpc.GrpcServerConfiguration
15
13
import kotlinx.rpc.grpc.ServerBuilder
16
- import kotlinx.rpc.grpc.codec.EmptyMessageCodecResolver
17
- import kotlinx.rpc.grpc.codec.MessageCodecResolver
18
14
19
15
@Suppress(" ConstPropertyName" )
20
16
public object GrpcConfigKeys {
@@ -51,8 +47,7 @@ public val GrpcServerKey: AttributeKey<GrpcServer> = AttributeKey<GrpcServer>("G
51
47
*/
52
48
public fun Application.grpc (
53
49
port : Int = environment.config.propertyOrNull(GrpcConfigKeys .grpcHostPortPath)?.getAs<Int >() ? : 8001,
54
- messageCodecResolver : MessageCodecResolver = EmptyMessageCodecResolver ,
55
- configure : ServerBuilder <* >.() -> Unit = {},
50
+ configure : GrpcServerConfiguration .() -> Unit = {},
56
51
builder : RpcServer .() -> Unit ,
57
52
): GrpcServer {
58
53
if (attributes.contains(GrpcServerKey )) {
@@ -64,9 +59,8 @@ public fun Application.grpc(
64
59
newServer = true
65
60
GrpcServer (
66
61
port = port,
67
- messageCodecResolver = messageCodecResolver,
68
62
parentContext = coroutineContext,
69
- serverBuilder = configure,
63
+ configure = configure,
70
64
builder = builder,
71
65
)
72
66
}
0 commit comments