Skip to content

Commit

Permalink
Add a feature switch for DCAR galleries
Browse files Browse the repository at this point in the history
Makes sure galleries will never be rendered by DCAR while we're working on them. Then allows us to make them available when they're ready, and quickly turn them off if there are any issues.
  • Loading branch information
JamieB-gu committed Oct 24, 2024
1 parent ee0ab9a commit d403150
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions applications/app/services/dotcomrendering/GalleryPicker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import model.Cors.RichRequestHeader
import model.GalleryPage
import play.api.mvc.RequestHeader
import utils.DotcomponentsLogger
import conf.switches.Switches.DCARGalleryPages

object GalleryPicker extends GuLogging {

Expand All @@ -22,13 +23,12 @@ object GalleryPicker extends GuLogging {
request: RequestHeader,
): RenderType = {

val participatingInTest = false // until we create a test for this content type
val dcrCanRender = dcrCouldRender(galleryPage)

val tier = {
if (request.forceDCROff) LocalRender
else if (request.forceDCR) RemoteRender
else if (dcrCanRender && participatingInTest) RemoteRender
else if (request.forceDCR && DCARGalleryPages.isSwitchedOn()) RemoteRender
else if (dcrCanRender && DCARGalleryPages.isSwitchedOn()) RemoteRender
else LocalRender
}

Expand Down
10 changes: 10 additions & 0 deletions common/app/conf/switches/FeatureSwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -512,4 +512,14 @@ trait FeatureSwitches {
sellByDate = LocalDate.of(2024, 11, 29),
exposeClientSide = true,
)

val DCARGalleryPages = Switch(
SwitchGroup.Feature,
"dcar-gallery-pages",
"If this switch is on, we will render gallery pages with DCAR",
owners = Seq(Owner.withEmail("[email protected]")),
safeState = Off,
sellByDate = never,
exposeClientSide = false,
)
}

0 comments on commit d403150

Please sign in to comment.