From b8f8bef947520abf0073381799cef8e3d1b8acd4 Mon Sep 17 00:00:00 2001 From: David Poltorak Date: Wed, 20 Dec 2023 14:26:14 +0000 Subject: [PATCH] feat: add configuration for gRPC usePlainText Signed-off-by: David Poltorak --- .../server/src/main/resources/application.conf | 2 ++ .../scala/io/iohk/atala/agent/server/Modules.scala | 12 +++++++++--- .../iohk/atala/agent/server/config/AppConfig.scala | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/prism-agent/service/server/src/main/resources/application.conf b/prism-agent/service/server/src/main/resources/application.conf index 1fd5185045..8d5b037a40 100644 --- a/prism-agent/service/server/src/main/resources/application.conf +++ b/prism-agent/service/server/src/main/resources/application.conf @@ -4,6 +4,8 @@ prismNode { host = ${?PRISM_NODE_HOST} port = 50053 port = ${?PRISM_NODE_PORT} + usePlainText = false + usePlainText = ${?PRISM_NODE_USE_PLAIN_TEXT} } } diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala index 0282f36e06..fd60ac4fc4 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala @@ -126,9 +126,15 @@ object GrpcModule { .service[AppConfig] .map(_.prismNode.service) .flatMap(config => - ZIO.attempt( - NodeServiceGrpc.stub(ManagedChannelBuilder.forAddress(config.host, config.port).build) - ) + if (config.usePlainText) { + ZIO.attempt( + NodeServiceGrpc.stub(ManagedChannelBuilder.forAddress(config.host, config.port).usePlaintext().build) + ) + } else { + ZIO.attempt( + NodeServiceGrpc.stub(ManagedChannelBuilder.forAddress(config.host, config.port).build) + ) + } ) ) SystemModule.configLayer >>> stubLayer diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/config/AppConfig.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/config/AppConfig.scala index cf98969a1f..b759281148 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/config/AppConfig.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/config/AppConfig.scala @@ -48,7 +48,7 @@ final case class ConnectConfig( final case class PrismNodeConfig(service: GrpcServiceConfig) -final case class GrpcServiceConfig(host: String, port: Int) +final case class GrpcServiceConfig(host: String, port: Int, usePlainText: Boolean) final case class DatabaseConfig( host: String,