From f0958eac3f9a68465d9ba49b37f620440687e5f7 Mon Sep 17 00:00:00 2001 From: Jake Lee Kennedy Date: Wed, 4 Dec 2024 15:21:45 +0000 Subject: [PATCH] cant use configuration --- common/app/common/CommercialBundle.scala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/common/app/common/CommercialBundle.scala b/common/app/common/CommercialBundle.scala index 38ae0d0480d..a129814f7af 100644 --- a/common/app/common/CommercialBundle.scala +++ b/common/app/common/CommercialBundle.scala @@ -3,19 +3,29 @@ package common import scala.concurrent.duration._ import org.joda.time.Instant import conf.Configuration +import services.ParameterStore object CommercialBundle { import GuardianConfiguration._ + private lazy val parameterStore = new ParameterStore(Environment.awsRegion) + private var cachedBundlePath: String = - "test_commercial_bundles/" + configuration.getMandatoryStringProperty("commercial.bundlePath") + "test_commercial_bundles/" + bundlePathParameterValue private var cachedTimestamp: Instant = Instant.now() private val cacheDuration: FiniteDuration = 1.minute private val assetHost = Configuration.assets.path + private def bundlePathParameterValue: String = { + if (Environment.stage == "CODE") + parameterStore.get("/frontend/CODE/commercial.bundlePath") + else + parameterStore.get("/frontend/commercial.bundlePath") + } + private def updateBundlePath(): Unit = { - cachedBundlePath = "test_commercial_bundles/" + configuration.getMandatoryStringProperty("commercial.bundlePath") + cachedBundlePath = "test_commercial_bundles/" + bundlePathParameterValue cachedTimestamp = Instant.now() }