From ec25ede6f3654bddf59e091f416b39e1e2d10b3d Mon Sep 17 00:00:00 2001 From: Oliver <20188437+olivergrabinski@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:58:43 +0200 Subject: [PATCH] Remove option usage --- .../scala/ch/epfl/bluebrain/nexus/ship/ProjectMapper.scala | 6 +++--- .../ch/epfl/bluebrain/nexus/ship/config/ShipConfig.scala | 2 +- .../epfl/bluebrain/nexus/ship/config/ShipConfigSuite.scala | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/ProjectMapper.scala b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/ProjectMapper.scala index cfd5c52b3b..c3fc1f4629 100644 --- a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/ProjectMapper.scala +++ b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/ProjectMapper.scala @@ -9,11 +9,11 @@ trait ProjectMapper { object ProjectMapper { - def apply(projectMapping: Option[ProjectMapping]): ProjectMapper = + def apply(projectMapping: ProjectMapping): ProjectMapper = (project: ProjectRef) => projectMapping match { - case Some(mapping) => mapping.getOrElse(project, project) - case None => project + case m if m.isEmpty => project + case mapping => mapping.getOrElse(project, project) } } diff --git a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfig.scala b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfig.scala index 7107a279ed..c643673914 100644 --- a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfig.scala +++ b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfig.scala @@ -19,7 +19,7 @@ final case class ShipConfig( database: DatabaseConfig, eventLog: EventLogConfig, organizations: OrganizationCreationConfig, - projectMapping: Option[ProjectMapping], + projectMapping: ProjectMapping = Map.empty, serviceAccount: ServiceAccountConfig ) diff --git a/ship/src/test/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfigSuite.scala b/ship/src/test/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfigSuite.scala index 7454e8e390..97974894e8 100644 --- a/ship/src/test/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfigSuite.scala +++ b/ship/src/test/scala/ch/epfl/bluebrain/nexus/ship/config/ShipConfigSuite.scala @@ -28,7 +28,7 @@ class ShipConfigSuite extends NexusSuite { for { externalConfigPath <- loader.absolutePath("config/project-mapping.conf") mapping = ShipConfig.load(Some(Path(externalConfigPath))).map(_.projectMapping) - _ <- mapping.assertEquals(Some(expected)) + _ <- mapping.assertEquals(expected) } yield () }