Allow apse1 on staging and local only (#20897)

* Allow apse1 on staging and local only

* Fix

* Fix

* Fix

* Fix

* Fix
This commit is contained in:
Joshen Lim authored and GitHub committed 2024-01-31 15:50:16 +07:00
1 parent 6118a3986b
commit e7a9131d56
4 files changed
+15 -9

No files matched your search

@@ -4,8 +4,7 @@ import { pluckObjectFields } from 'lib/helpers'
export function getAvailableRegions(cloudProvider: CloudProvider): Region {
if (cloudProvider === 'AWS') {
return process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'
? // [Joshen] TEMP FIX, CHANGE BACK TO APSE1
pluckObjectFields(AWS_REGIONS, ['NORTHEAST_ASIA'])
? pluckObjectFields(AWS_REGIONS, ['SOUTHEAST_ASIA'])
: AWS_REGIONS
} else if (cloudProvider === 'FLY') {
return FLY_REGIONS
@@ -31,8 +31,10 @@ export const RegionSelector = ({
useEffect(() => {
// only pick a region if one hasn't already been selected
if (isSuccess && region && !selectedRegion) {
// [Joshen] TEMP FIX, CHANGE BACK TO APSE1
if (region !== 'Singapore') onSelectRegion(region)
// [Joshen] TEMP FIX BLOCK APSE 1 ON PROD
if (process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod' && region === 'Southeast Asia (Singapore)')
return
onSelectRegion(region)
} else if (isError && !selectedRegion) {
// if an error happened, and the user haven't selected a region, just select the default one for him
onSelectRegion(PROVIDERS[cloudProvider].default_region)
@@ -54,7 +54,8 @@ export const AVAILABLE_REPLICA_REGIONS: Region[] = Object.keys(AWS_REGIONS)
.map((key) => {
return {
key: key as AWS_REGIONS_KEYS,
name: AWS_REGIONS[key as AWS_REGIONS_KEYS],
// [Joshen] TEMP FIX BLOCK APSE 1 ON PROD, remove ternary
name: AWS_REGIONS?.[key as AWS_REGIONS_KEYS] ?? '',
region: AWS_REGIONS_VALUES[key],
coordinates: AWS_REGIONS_COORDINATES[key],
}
+8 -4
View File
@@ -17,8 +17,10 @@ export const AWS_REGIONS = {
// 'North EU': 'North EU',
CENTRAL_EU: 'Central EU (Frankfurt)',
SOUTH_ASIA: 'South Asia (Mumbai)',
// [Joshen] Temp block apse1 for prod
// SOUTHEAST_ASIA: 'Southeast Asia (Singapore)'
// [Joshen] TEMP FIX BLOCK APSE 1 ON PROD
...(process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod'
? { SOUTHEAST_ASIA: 'Southeast Asia (Singapore)' }
: {}),
NORTHEAST_ASIA: 'Northeast Asia (Tokyo)',
NORTHEAST_ASIA_2: 'Northeast Asia (Seoul)',
OCEANIA: 'Oceania (Sydney)',
@@ -32,9 +34,11 @@ export const FLY_REGIONS = {
SOUTHEAST_ASIA: 'Singapore',
} as const
// [Joshen] TEMP FIX, CHANGE BACK TO APSE1
// [Joshen] TEMP FIX BLOCK APSE 1 ON PROD, remove as string
export const AWS_REGIONS_DEFAULT =
process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod' ? AWS_REGIONS.NORTHEAST_ASIA : AWS_REGIONS.WEST_US
process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod'
? (AWS_REGIONS.SOUTHEAST_ASIA as string)
: AWS_REGIONS.WEST_US
// TO DO, change default to US region for prod
const FLY_REGIONS_DEFAULT = FLY_REGIONS.SOUTHEAST_ASIA