Skip to content

Commit

Permalink
Remove test and set live commercial bundle updater (#27716)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeii authored Jan 14, 2025
1 parent 6c70a7f commit 701d9b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
9 changes: 8 additions & 1 deletion common/app/common/CommercialBundle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ object CommercialBundle {
private var cachedBundlePath: String = bundlePathFromParameterStore
private var cachedTimestamp: Instant = Instant.now()

private def bundlePathFromParameterStore: String = parameterStore.get(bundlePathKey)
private def bundlePathFromParameterStore: String = {
if (stage == "devinfra" || stage == "localtest") {
// don't read from parameter store in these environments as there may not be any credentials
"commercial"
} else {
parameterStore.get(bundlePathKey)
}
}

private def bundlePath: String = {
if (Instant.now().isAfter(cachedTimestamp.plus(cacheDuration.toMillis))) {
Expand Down
10 changes: 0 additions & 10 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ object ActiveExperiments extends ExperimentsDefinition {
override val allExperiments: Set[Experiment] =
Set(
EuropeBetaFront,
CommercialBundleUpdater,
DCRCrosswords,
DarkModeWeb,
)
Expand All @@ -32,15 +31,6 @@ object EuropeBetaFront
participationGroup = Perc0A,
)

object CommercialBundleUpdater
extends Experiment(
name = "commercial-bundle-updater",
description = "Enable the commercial bundle updater",
owners = Seq(Owner.withGithub("jakeii")),
sellByDate = LocalDate.of(2025, 1, 30),
participationGroup = Perc20A,
)

object DCRCrosswords
extends Experiment(
name = "dcr-crosswords",
Expand Down
10 changes: 2 additions & 8 deletions common/app/views/support/JavaScriptPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import model.dotcomrendering.DotcomRenderingUtils.assetURL
import play.api.mvc.RequestHeader
import views.support.Commercial.isAdFree
import common.CommercialBundle
import experiments.{ActiveExperiments, CommercialBundleUpdater}

object JavaScriptPage {

Expand Down Expand Up @@ -72,13 +71,8 @@ object JavaScriptPage {

val ipsos = if (page.metadata.isFront) getScriptTag(page.metadata.id) else getScriptTag(page.metadata.sectionId)

val commercialBundleUrl =
if (ActiveExperiments.isParticipating(CommercialBundleUpdater)(request))
Configuration.commercial.overrideCommercialBundleUrl
.getOrElse(CommercialBundle.bundleUrl)
else
Configuration.commercial.overrideCommercialBundleUrl
.getOrElse(assetURL("javascripts/commercial/graun.standalone.commercial.js"))
val commercialBundleUrl = Configuration.commercial.overrideCommercialBundleUrl
.getOrElse(CommercialBundle.bundleUrl)

javascriptConfig ++ config ++ commercialMetaData ++ journalismMetaData ++ Map(
("edition", JsString(edition.id)),
Expand Down

0 comments on commit 701d9b5

Please sign in to comment.