Skip to content

Commit

Permalink
EDSC-3971: Using Correct type of feature toggle in static.config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
eudoroolivares2016 committed Jan 20, 2024
1 parent 56a25bc commit 4fc77e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/deploy-bamboo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ config="`jq '.application.analytics.gtmPropertyId = $newValue' --arg newValue $b
config="`jq '.application.granuleLinksPageSize = $newValue' --arg newValue $bamboo_GRANULE_LINKS_PAGE_SIZE <<< $config`"
config="`jq '.application.openSearchGranuleLinksPageSize = $newValue' --arg newValue $bamboo_OPEN_SEARCH_GRANULE_LINKS_PAGE_SIZE <<< $config`"
config="`jq '.application.disableEddDownload = $newValue' --arg newValue $bamboo_DISABLE_EDD_DOWNLOAD <<< $config`"
config="`jq '.application.disableOrdering = $newValue' --arg newValue $bamboo_DISABLE_ORDERING <<< $config`"
config="`jq '.application.macOSEddDownloadSize = $newValue' --arg newValue $bamboo_MACOS_EDD_DOWNLOAD_SIZE <<< $config`"
config="`jq '.application.windowsEddDownloadSize = $newValue' --arg newValue $bamboo_WINDOWS_EDD_DOWNLOAD_SIZE <<< $config`"
config="`jq '.application.linuxEddDownloadSize = $newValue' --arg newValue $bamboo_LINUX_EDD_DOWNLOAD_SIZE <<< $config`"
Expand Down Expand Up @@ -92,7 +93,6 @@ dockerRun() {
-e "SUBNET_ID_A=$bamboo_SUBNET_ID_A" \
-e "SUBNET_ID_B=$bamboo_SUBNET_ID_B" \
-e "VPC_ID=$bamboo_VPC_ID" \
-e "DISABLE_ORDERING=$bamboo_DISABLE_ORDERING" \
$dockerTag "$@"
}
Expand Down
2 changes: 0 additions & 2 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ provider:
obfuscationSpinShapefiles: ${self:custom.variables.obfuscationSpinShapefiles}

orderDelaySeconds: ${self:custom.variables.orderDelaySeconds}
disableOrdering: ${self:custom.variables.disableOrdering}

configSecretId:
Fn::ImportValue: ${self:provider.stage}-DbPasswordSecret
Expand Down Expand Up @@ -124,7 +123,6 @@ custom:
obfuscationSpin: ${env:OBFUSCATION_SPIN, ''}
obfuscationSpinShapefiles: ${env:OBFUSCATION_SPIN_SHAPEFILES, ''}
orderDelaySeconds: ${env:ORDER_DELAY_SECONDS, '1'}
disableOrdering: ${env:DISABLE_ORDERING, 'false'}

cloudfrontToCloudwatchBucketPrefixApi:
Fn::Join:
Expand Down
1 change: 1 addition & 0 deletions static.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"lambda": "eed-PORTAL-ENV-serverless-lambda"
},
"disableEddDownload": "false",
"disableOrdering": false,
"macOSEddDownloadSize":130,
"windowsEddDownloadSize":100,
"linuxEddDownloadSize":90
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { buildAccessMethods } from '../buildAccessMethods'

import * as getApplicationConfig from '../../../../../../sharedUtils/config'

const OLD_ENV = process.env

beforeEach(() => {
jest.clearAllMocks()

// Manage resetting ENV variables
jest.resetModules()
process.env = { ...OLD_ENV }
delete process.env.NODE_ENV
jest.spyOn(getApplicationConfig, 'getApplicationConfig').mockImplementation(() => ({
disableOrdering: false
}))
})

afterEach(() => {
Expand Down Expand Up @@ -131,7 +130,10 @@ describe('buildAccessMethods', () => {

describe('when ordering is disabled', () => {
test('no echo-order access method is returned', () => {
process.env.disableOrdering = true
jest.spyOn(getApplicationConfig, 'getApplicationConfig').mockImplementation(() => ({
disableOrdering: true
}))

const collectionMetadata = {
services: {
items: [{
Expand Down
5 changes: 4 additions & 1 deletion static/src/js/util/accessMethods/buildAccessMethods.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { camelCase, uniq } from 'lodash'

import { getApplicationConfig } from '../../../../../sharedUtils/config'

import { isDownloadable } from '../../../../../sharedUtils/isDownloadable'
import { generateFormDigest } from './generateFormDigest'
import { getVariables } from './getVariables'
Expand All @@ -26,7 +28,8 @@ export const buildAccessMethods = (collectionMetadata, isOpenSearch) => {
const accessMethods = {}
let harmonyIndex = 0
const { items: serviceItems = null } = services
const { disableOrdering } = process.env

const { disableOrdering } = getApplicationConfig()

if (serviceItems !== null) {
serviceItems.forEach((serviceItem) => {
Expand Down

0 comments on commit 4fc77e8

Please sign in to comment.