Skip to content

Commit

Permalink
PIN-4571 Changed to env var
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli committed Feb 20, 2024
1 parent 048ff65 commit 3b96c42
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/main/resources/application-standalone.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ akka {

catalog-process {
port = 8088
producer-allowed-origins = "IPA"
services {
catalog-management = "https://gateway.interop.pdnd.dev/catalog-management/0.1"
authorization-management = "https://gateway.interop.pdnd.dev/key-management/0.1"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ akka {

catalog-process {
port = 8088
producer-allowed-origins = ${PRODUCER_ALLOWED_ORIGINS}
services {
catalog-management = ${CATALOG_MANAGEMENT_URL}
authorization-management = ${AUTHORIZATION_MANAGEMENT_URL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import it.pagopa.interop.commons.jwt._
import it.pagopa.interop.commons.logging.{CanLogContextFields, ContextFieldsToLog}
import it.pagopa.interop.commons.riskanalysis.api.impl.RiskAnalysisValidation
import it.pagopa.interop.commons.riskanalysis.{model => Commons}
import it.pagopa.interop.commons.utils.PRODUCER_ALLOWED_ORIGINS
import it.pagopa.interop.commons.utils.AkkaUtils._
import it.pagopa.interop.commons.utils.OpenapiUtils.parseArrayParameters
import it.pagopa.interop.commons.utils.TypeConversions._
Expand All @@ -44,6 +43,7 @@ import it.pagopa.interop.agreementmanagement.model.agreement.{

import java.util.UUID
import scala.concurrent.{ExecutionContext, Future}
import it.pagopa.interop.catalogprocess.common.system.ApplicationConfiguration

final case class ProcessApiServiceImpl(
catalogManagementService: CatalogManagementService,
Expand All @@ -70,7 +70,9 @@ final case class ProcessApiServiceImpl(
val result: Future[EService] = for {
organizationId <- getOrganizationIdFutureUUID(contexts)
origin <- getExternalIdOriginFuture(contexts)
_ <- if (PRODUCER_ALLOWED_ORIGINS.contains(origin)) Future.unit else Future.failed(OriginIsNotAllowed(origin))
_ <-
if (ApplicationConfiguration.producerAllowedOrigins.contains(origin)) Future.unit
else Future.failed(OriginIsNotAllowed(origin))
clientSeed = eServiceSeed.toDependency(organizationId)
_ <- checkDuplicateName(organizationId, None, eServiceSeed.name, clientSeed.producerId)
createdEService <- catalogManagementService.createEService(clientSeed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import it.pagopa.interop.commons.cqrs.model.ReadModelConfig
object ApplicationConfiguration {
val config: Config = ConfigFactory.load()

val serverPort: Int = config.getInt("catalog-process.port")

val catalogManagementUrl: String = config.getString("catalog-process.services.catalog-management")
val authorizationManagementUrl: String = config.getString("catalog-process.services.authorization-management")
val serverPort: Int = config.getInt("catalog-process.port")
val producerAllowedOrigins: Set[String] =
config.getString("catalog-process.producer-allowed-origins").split(",").toSet.filter(_.nonEmpty)
val catalogManagementUrl: String = config.getString("catalog-process.services.catalog-management")
val authorizationManagementUrl: String = config.getString("catalog-process.services.authorization-management")

val jwtAudience: Set[String] = config.getString("catalog-process.jwt.audience").split(",").toSet.filter(_.nonEmpty)

Expand Down
14 changes: 14 additions & 0 deletions src/test/resources/application-test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ akka {
}

catalog-process {
producer-allowed-origins = "IPA"
url = "http://localhost:18088/catalog-process"
services {
catalog-management = "CATALOG_MANAGEMENT_URL"
authorization-management = "AUTHORIZATION_MANAGEMENT_URL"
}
jwt {
audience = "test.interop.pagopa.it/ui"
}
port = 18088
read-model {
db {
name = "READ_MODEL_DB_NAME"
connection-string = "READ_MODEL_CONNECTION_STRING"
}
}
}

0 comments on commit 3b96c42

Please sign in to comment.