Skip to content

Commit

Permalink
Must read configuration values as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
flashingpumpkin committed Jul 6, 2017
1 parent 2a688fb commit c0fd306
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/uk/gov/hmrc/epayeapi/config/AppContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ case class AppContext @Inject() (config: DefaultServicesConfig) {
val apiContext: String = current.getString(s"api.context").getOrElse(throw new RuntimeException(s"Missing Key $env.api.context"))
val apiStatus: String = current.getString("api.status").getOrElse(throw new RuntimeException(s"Missing Key $env.api.status"))
val useSandboxConnectors: Boolean = current.getBoolean("useSandboxConnectors").getOrElse(false)
val whitelistedApplications: Seq[String] = current.getStringSeq("whitelistedApplications").getOrElse(Seq.empty[String])
val whitelistedApplications: Seq[String] =
current.getString("whitelistedApplications").getOrElse("").split(",").filter(_.nonEmpty).map(_.trim)

Logger.info(s"AppContext startup: " +
s"env=$env " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import play.api.test.Helpers._

class DocumentationSpec extends AppSpec {
"The API definition endpoint" should {
"include whitelisted applications" in new App(builder.withConfig("whitelistedApplications" -> Seq("my-application-id", "my-other-application-id")).build) {
"include whitelisted applications" in new App(builder.withConfig("whitelistedApplications" -> "my-application-id, my-other-application-id").build) {
val result = contentAsJson(inject[Documentation].definition()(FakeRequest()))

val lookupResult = (result \\ "whitelistedApplicationIds" ).head
Expand Down

0 comments on commit c0fd306

Please sign in to comment.