Skip to content

Commit

Permalink
Merge pull request #4081 from omnipresent07/cors-on-public-endpoints
Browse files Browse the repository at this point in the history
add cors on public endpoints
  • Loading branch information
omnipresent07 authored Apr 11, 2021
2 parents 6941714 + 39469c0 commit ac49967
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import cormorant.generic.semiauto._
import hmda.publisher.query.lar.LarEntityImpl2020WithMsa.{enforcePartialRead, readNext}
import hmda.util.PsvParsingCompanion
import io.chrisdavenport.cormorant.CSV

// $COVERAGE-OFF$
case class LarPartOne2020(
id: Int = 0,
lei: String = "",
Expand Down Expand Up @@ -335,4 +335,5 @@ object LarEntityImpl2020WithMsa extends PsvParsingCompanion[LarEntityImpl2020Wit
msaName <- readNext[String].read(rest)
} yield LarEntityImpl2020WithMsa(lar.copy(larPartSeven = p7), Msa(msaId, msaName))).map(Right(_))
}
}
}
// $COVERAGE-ON$
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import cormorant.generic.semiauto._
import hmda.publisher.query.lar.LarEntityImpl2021WithMsa.{enforcePartialRead, readNext}
import hmda.util.PsvParsingCompanion
import io.chrisdavenport.cormorant.CSV

// $COVERAGE-OFF$
case class LarPartOne2021(
id: Int = 0,
lei: String = "",
Expand Down Expand Up @@ -335,4 +335,5 @@ object LarEntityImpl2021WithMsa extends PsvParsingCompanion[LarEntityImpl2021Wit
msaName <- readNext[String].read(rest)
} yield LarEntityImpl2021WithMsa(lar.copy(larPartSeven = p7), Msa(msaId, msaName))).map(Right(_))
}
}
}
// $COVERAGE-ON$
6 changes: 5 additions & 1 deletion hmda/src/main/scala/hmda/api/http/HmdaPublicApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import hmda.api.http.directives.HmdaTimeDirectives._
import scala.concurrent.ExecutionContext
import akka.http.scaladsl.server.Directives._
import akka.actor.typed.scaladsl.adapter._
import ch.megard.akka.http.cors.scaladsl.CorsDirectives._

// This is just a Guardian for starting up the API
// $COVERAGE-OFF$
Expand All @@ -25,7 +26,10 @@ object HmdaPublicApi {
val config = system.settings.config
val host: String = config.getString("hmda.http.publicHost")
val port: Int = config.getInt("hmda.http.publicPort")
val routes = BaseHttpApi.routes(name) ~ TsValidationHttpApi.create ~ LarValidationHttpApi.create ~ HmdaFileValidationHttpApi.create ~ HmdaFileParsingHttpApi.create
val routes = cors() {
BaseHttpApi.routes(name) ~ TsValidationHttpApi.create ~ LarValidationHttpApi.create ~ HmdaFileValidationHttpApi.create ~ HmdaFileParsingHttpApi.create
}


BaseHttpApi.runServer(shutdown, name)(timed(routes), host, port)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ object InstitutionDBProjection extends InstitutionEmailComponent with Institutio
}

val institutionNoteHistoryEntity: InstitutionNoteHistoryEntity = generateHistoryID(inst)
println ("This is updated panel: " + institutionNoteHistoryEntity.updatedPanel)
institutionNotesHistoryRepository.insertOrUpdate(institutionNoteHistoryEntity)

val emails = InstitutionConverter.emailsFromInstitution(inst).toList
Expand Down

0 comments on commit ac49967

Please sign in to comment.