watchdog-be #12
|
@ -3,8 +3,8 @@ package dev.usbharu.unos.watchdog.be
|
|||
import io.grpc.ServerBuilder
|
||||
import io.ktor.server.application.*
|
||||
|
||||
fun Application.grpc(pushMetricsService: PushMetricsService){
|
||||
val server = ServerBuilder.forPort(50051)
|
||||
fun Application.grpc(port:Int,pushMetricsService: PushMetricsService){
|
||||
val server = ServerBuilder.forPort(port)
|
||||
.addService(pushMetricsService)
|
||||
.build()
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ fun Application.module() {
|
|||
|
||||
val url = environment.config.property("watchdog.db.url").getString()
|
||||
val databaseName = environment.config.property("watchdog.db.database").getString()
|
||||
val grpcPort = environment.config.property("watchdog.grpc.port").getString().toInt()
|
||||
val database =
|
||||
MongoClient
|
||||
.create(
|
||||
|
@ -33,7 +34,7 @@ fun Application.module() {
|
|||
|
||||
val mongoMetricsRepository = MongoMetricsRepository(database)
|
||||
|
||||
grpc(PushMetricsService(mongoMetricsRepository))
|
||||
grpc(grpcPort,PushMetricsService(mongoMetricsRepository))
|
||||
routing {
|
||||
api(ApiController(mongoMetricsRepository))
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ watchdog {
|
|||
url = "mongodb://localhost:27017"
|
||||
database = "watchdog"
|
||||
}
|
||||
|
||||
grpc {
|
||||
port = 50051
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue