Skip to content

Commit

Permalink
Merge pull request #121 from hmrc/PLATOPS-2060
Browse files Browse the repository at this point in the history
PLATOPS-2060: Refactor
  • Loading branch information
tomasz-rosiek authored Mar 28, 2019
2 parents 4e7f611 + 49e4703 commit 8567d36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/main/play-25/uk/gov/hmrc/play/config/GTMConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import play.api.Configuration

class GTMConfig @Inject()(configuration: Configuration) {
val url: Option[String] =
configuration.getString("gtm.container") match {
case None => None
case Some(container @ ("transitional" | "main")) =>
configuration.getString("gtm.container").map {
case container @ ("transitional" | "main") =>
configuration
.getString(s"gtm.$container.url")
.orElse(throw new RuntimeException(s"Missing configuration gtm.$container.url"))
.getOrElse(throw new RuntimeException(s"Missing configuration gtm.$container.url"))
case _ => throw new IllegalArgumentException("gtm.container should be one of: { transitional, main }")
}
}
7 changes: 3 additions & 4 deletions src/main/play-26/uk/gov/hmrc/play/config/GTMConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import play.api.Configuration

class GTMConfig @Inject()(configuration: Configuration) {
val url: Option[String] =
configuration.getString("gtm.container") match {
case None => None
case Some(container @ ("transitional" | "main")) =>
configuration.getString("gtm.container").map {
case container @ ("transitional" | "main") =>
configuration
.getString(s"gtm.$container.url")
.orElse(throw new RuntimeException(s"Missing configuration gtm.$container.url"))
.getOrElse(throw new RuntimeException(s"Missing configuration gtm.$container.url"))
case _ => throw new IllegalArgumentException("gtm.container should be one of: { transitional, main }")
}
}

0 comments on commit 8567d36

Please sign in to comment.