Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Panda v7 - support key rotation #1747

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions app/controllers/BaseFaciaController.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package controllers

import java.util.Locale

import com.gu.pandomainauth.action.{AuthActions, UserRequest}
import com.gu.pandomainauth.model.AuthenticatedUser
import com.gu.pandomainauth.{PanDomain, PanDomainAuthSettingsRefresher}
import com.gu.pandomainauth.{
PanDomain,
PanDomainAuthSettingsRefresher,
S3BucketLoader
}
import com.gu.permissions.{PermissionsConfig, PermissionsProvider}
import conf.ApplicationConfiguration
import logging.Logging
Expand All @@ -30,12 +33,13 @@ abstract class BaseFaciaControllerComponents(context: Context)
def config: ApplicationConfiguration

lazy val panDomainSettings: PanDomainAuthSettingsRefresher =
new PanDomainAuthSettingsRefresher(
config.pandomain.domain,
config.pandomain.service,
config.pandomain.bucketName,
config.pandomain.settingsFileKey,
config.aws.s3Client
PanDomainAuthSettingsRefresher(
domain = config.pandomain.domain,
system = config.pandomain.service,
S3BucketLoader.forAwsSdkV1(
config.aws.s3Client,
"pan-domain-auth-settings"
)
)

lazy val permissions = PermissionsProvider(
Expand Down
2 changes: 1 addition & 1 deletion app/model/ClipboardCard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object ClipboardCard {
)
}

implicit val format = Format(reads, writes)
implicit val format: Format[ClipboardCard] = Format(reads, writes)
}

case class ClipboardCard(card: Either[Trail, EditionsClientCard])
12 changes: 6 additions & 6 deletions app/services/AwsEndpoints.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package services

import com.amazonaws.regions.ServiceAbbreviations.{S3 => S3Endpoint, _}
import com.amazonaws.regions.{Region, Regions}
import com.amazonaws.services.s3.AmazonS3.{ENDPOINT_PREFIX => S3Endpoint}
import com.amazonaws.services.cloudwatch.AmazonCloudWatch.{
ENDPOINT_PREFIX => CloudWatch
}
import com.amazonaws.regions.RegionUtils
import conf.ApplicationConfiguration

class AwsEndpoints(val config: ApplicationConfiguration) {
private lazy val region =
Region.getRegion(Regions.fromName(config.aws.region))
RegionUtils.getRegion(config.aws.region)

lazy val sns: String = region.getServiceEndpoint(SNS)
lazy val elb: String = region.getServiceEndpoint(ElasticLoadbalancing)
lazy val monitoring: String = region.getServiceEndpoint(CloudWatch)
lazy val dynamoDb: String = region.getServiceEndpoint(Dynamodb)
lazy val s3: String = region.getServiceEndpoint(S3Endpoint)
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class FeastPublicationTarget(
)
case EditionsFeastCollection(_, _, metadata) =>
val recipes = metadata
.map(_.collectionItems.map { case EditionsRecipe(id, _) =>
.map(_.collectionItems.collect { case EditionsRecipe(id, _) =>
id
})
.getOrElse(List.empty)
Expand Down
2 changes: 1 addition & 1 deletion app/switchboard/Switchboard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Lifecycle(conf: SwitchboardConfiguration, scheduler: Scheduler)
scheduler.scheduleWithFixedDelay(0.seconds, 1.minute) { () =>
refreshSwitches()
}
scheduler.scheduleOnce(0.seconds) { () => refreshSwitches() }
scheduler.scheduleOnce(0.seconds)(refreshSwitches())

def refreshSwitches(): Unit = {
logger.info("Refreshing switches from switchboard")
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ libraryDependencies ++= Seq(
"com.gu" %% "editorial-permissions-client" % "3.0.0",
"com.gu" %% "fapi-client-play30" % "13.0.0",
"com.gu" %% "mobile-notifications-api-models" % "3.0.0",
"com.gu" %% "pan-domain-auth-play_3-0" % "4.0.0",
"com.gu" %% "pan-domain-auth-play_3-0" % "7.0.0",
"org.scanamo" %% "scanamo" % "1.1.1" exclude ("org.scala-lang.modules", "scala-java8-compat_2.13"),
"com.github.blemale" %% "scaffeine" % "4.1.0" % "compile",
"com.gu" %% "thrift-serializer" % "4.0.2",
Expand Down
Loading