diff --git a/mediator/src/main/resources/application.conf b/mediator/src/main/resources/application.conf index a115ea5e..7ab2a465 100644 --- a/mediator/src/main/resources/application.conf +++ b/mediator/src/main/resources/application.conf @@ -35,4 +35,6 @@ mediator = { dbName = "mediator" dbName = ${?MONGODB_DB_NAME} } + problem.report.escalateTo = "atala@iohk.io" + problem.report.escalateTo = ${?ESCALATE_TO} } diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/actions/ProtocolExecute.scala b/mediator/src/main/scala/io/iohk/atala/mediator/actions/ProtocolExecute.scala index cb132c24..aa4f1590 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/actions/ProtocolExecute.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/actions/ProtocolExecute.scala @@ -18,7 +18,7 @@ import io.iohk.atala.mediator.protocols.MissingProtocolExecuter trait ProtocolExecuter[-R, +E] { // <: MediatorError | StorageError] { - def suportedPIURI: Seq[PIURI] + def supportedPIURI: Seq[PIURI] /** @return can return a Sync Reply Msg */ def execute[R1 <: R]( @@ -37,9 +37,9 @@ case class ProtocolExecuterCollection[-R <: Agent, +E]( executers: ProtocolExecuter[R, E]* ) extends ProtocolExecuter[R, E] { - override def suportedPIURI: Seq[PIURI] = executers.flatMap(_.suportedPIURI) + override def supportedPIURI: Seq[PIURI] = executers.flatMap(_.supportedPIURI) - def selectExecutersFor(piuri: PIURI) = executers.find(_.suportedPIURI.contains(piuri)) + def selectExecutersFor(piuri: PIURI) = executers.find(_.supportedPIURI.contains(piuri)) override def execute[R1 <: R]( plaintextMessage: PlaintextMessage, diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorStandalone.scala b/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorStandalone.scala index eb9bef4b..5b1b49ec 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorStandalone.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorStandalone.scala @@ -68,10 +68,6 @@ object MediatorStandalone extends ZIOAppDefault { Request, Response ] = MediatorAgent.didCommApp - ++ Http - .collectZIO[Request] { case Method.GET -> Root / "hello" => - ZIO.succeed(Response.text("Hello World! DID Comm Mediator APP")).debug - } override val run = for { _ <- Console.printLine( // https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Mediator """███╗ ███╗███████╗██████╗ ██╗ █████╗ ████████╗ ██████╗ ██████╗ @@ -98,6 +94,12 @@ object MediatorStandalone extends ZIOAppDefault { .nested("mediator") .load(Config.int("port")) _ <- ZIO.log(s"Starting server on port: $port") + escalateTo <- configs + .nested("report") + .nested("problem") + .nested("mediator") + .load(Config.string("escalateTo")) + _ <- ZIO.log(s"Problem reports escalated to : $escalateTo") client = Scope.default >>> Client.default inboundHub <- Hub.bounded[String](5) myServer <- Server diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/BasicMessageExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/BasicMessageExecuter.scala index 9b607581..c5141d00 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/BasicMessageExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/BasicMessageExecuter.scala @@ -9,7 +9,7 @@ import zio.{Console, ZIO} object BasicMessageExecuter extends ProtocolExecuter[Any, MediatorError] { - override def suportedPIURI: Seq[PIURI] = Seq(BasicMessage.piuri) + override def supportedPIURI: Seq[PIURI] = Seq(BasicMessage.piuri) override def program[R1 <: Any](plaintextMessage: PlaintextMessage) = for { job <- BasicMessage.fromPlaintextMessage(plaintextMessage) match case Left(error) => ZIO.fail(MediatorDidError(FailToParse(error))) diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala index 92b71884..dd816ec2 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala @@ -18,7 +18,7 @@ object ForwardMessageExecuter ProtocolExecuter.Erros ] { - override def suportedPIURI: Seq[PIURI] = Seq(ForwardMessage.piuri) + override def supportedPIURI: Seq[PIURI] = Seq(ForwardMessage.piuri) override def program[R1 <: UserAccountRepo & MessageItemRepo & Agent]( plaintextMessage: PlaintextMessage diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MediatorCoordinationExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MediatorCoordinationExecuter.scala index 2a065af3..c5ffeb51 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MediatorCoordinationExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MediatorCoordinationExecuter.scala @@ -20,7 +20,7 @@ object MediatorCoordinationExecuter ProtocolExecuter.Erros ] { - override def suportedPIURI: Seq[PIURI] = Seq( + override def supportedPIURI: Seq[PIURI] = Seq( MediateRequest.piuri, MediateGrant.piuri, MediateDeny.piuri, diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MissingProtocolExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MissingProtocolExecuter.scala index 40d481cb..5058497e 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MissingProtocolExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/MissingProtocolExecuter.scala @@ -10,7 +10,7 @@ import io.iohk.atala.mediator.actions.Reply object MissingProtocolExecuter extends ProtocolExecuter[Agent, Nothing] { - override def suportedPIURI = Seq() + override def supportedPIURI = Seq() override def program[R1 <: Agent](plaintextMessage: PlaintextMessage) = ZIO .service[Agent] diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/NullProtocolExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/NullProtocolExecuter.scala index 9013ca57..fc865bfb 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/NullProtocolExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/NullProtocolExecuter.scala @@ -7,7 +7,7 @@ import zio.ZIO object NullProtocolExecuter extends ProtocolExecuter[Any, MissingProtocolError] { - override def suportedPIURI = Seq() + override def supportedPIURI = Seq() override def program[R1 <: Any](plaintextMessage: PlaintextMessage) = ZIO.fail(MissingProtocolError(plaintextMessage.`type`)) } diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala index e5cbe4f6..941efe92 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala @@ -17,7 +17,7 @@ object PickupExecuter ProtocolExecuter.Erros ] { - override def suportedPIURI: Seq[PIURI] = Seq( + override def supportedPIURI: Seq[PIURI] = Seq( StatusRequest.piuri, Status.piuri, DeliveryRequest.piuri, diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala index 62673a99..121ba014 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala @@ -1,11 +1,13 @@ package io.iohk.atala.mediator.protocols +import com.typesafe.config.{Config, ConfigFactory} import fmgp.did.* import fmgp.did.comm.* import fmgp.did.comm.protocol.reportproblem2.* object Problems { - val email = Some("atala@iohk.io") + val config: Config = ConfigFactory.load() + val email: Option[String] = Option(config.getString("mediator.problem.report.escalateTo")) def unsupportedProtocolType( to: Set[TO], diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/TrustPingExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/TrustPingExecuter.scala index 4b973c4b..0b9b2772 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/TrustPingExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/TrustPingExecuter.scala @@ -15,7 +15,7 @@ import zio.ZIO class TrustPingExecuter extends ProtocolExecuterWithServices[ProtocolExecuter.Services, MediatorError] { - override def suportedPIURI: Seq[PIURI] = Seq(TrustPing.piuri, TrustPingResponse.piuri) + override def supportedPIURI: Seq[PIURI] = Seq(TrustPing.piuri, TrustPingResponse.piuri) override def program[R1 <: Agent]( plaintextMessage: PlaintextMessage