diff --git a/prism-agent/service/server/src/main/resources/application.conf b/prism-agent/service/server/src/main/resources/application.conf index d235251b2e..51d74a26a0 100644 --- a/prism-agent/service/server/src/main/resources/application.conf +++ b/prism-agent/service/server/src/main/resources/application.conf @@ -85,6 +85,8 @@ agent { port = 8085 port =${?AGENT_HTTP_PORT} } + publicEndpointUrl = "https://host.docker.internal:8080/prism-agent" + publicEndpointUrl = ${?REST_SERVICE_URL} } didCommEndpoint { http { @@ -122,8 +124,6 @@ agent { autoProvisioning = ${?API_KEY_AUTO_PROVISIONING} } } - restServiceUrl = "https://host.docker.internal:8080/prism-agent" - restServiceUrl = ${?REST_SERVICE_URL} database { host = "localhost" host = ${?AGENT_DB_HOST} 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 13b2725920..4b92900a80 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 @@ -126,7 +126,6 @@ final case class AgentConfig( httpEndpoint: HttpEndpointConfig, didCommEndpoint: DidCommEndpointConfig, authentication: AuthenticationConfig, - restServiceUrl: String, database: DatabaseConfig, verification: VerificationConfig, secretStorage: SecretStorageConfig, @@ -141,7 +140,7 @@ final case class AgentConfig( } } -final case class HttpEndpointConfig(http: HttpConfig) +final case class HttpEndpointConfig(http: HttpConfig, publicEndpointUrl: String) final case class DidCommEndpointConfig(http: HttpConfig, publicEndpointUrl: String) diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/IssueControllerImpl.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/IssueControllerImpl.scala index 32572456ff..fb270df4ff 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/IssueControllerImpl.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/IssueControllerImpl.scala @@ -85,11 +85,10 @@ class IssueControllerImpl( claims = jsonClaims, validityPeriod = request.validityPeriod, automaticIssuance = request.automaticIssuance.orElse(Some(true)), { + val publicEndpointUrl = appConfig.agent.httpEndpoint.publicEndpointUrl val urlSuffix = s"credential-definition-registry/definitions/${credentialDefinitionGUID.toString}/definition" - val urlPrefix = - if (appConfig.agent.restServiceUrl.endsWith("/")) appConfig.agent.restServiceUrl - else appConfig.agent.restServiceUrl + "/" + val urlPrefix = if (publicEndpointUrl.endsWith("/")) publicEndpointUrl else publicEndpointUrl + "/" s"$urlPrefix$urlSuffix" } )