Files
supabase/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
T
Alaister YoungandJoshen Lim e7cac83c4a chore: limit regions for nimbus (#38747)
* chore: limit regions for nimbus

* fix logic

* Autoselect east US if cloud provider is nimbus

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-25 16:09:15 +08:00

30 lines
841 B
TypeScript

import type { CloudProvider, Region } from 'shared-data'
import { AWS_REGIONS, FLY_REGIONS } from 'shared-data'
const smartRegionToExactRegionMap = new Map([
['Americas', 'East US (North Virginia)'],
['Europe', 'Central EU (Frankfurt)'],
['APAC', 'Southeast Asia (Singapore)'],
])
export function smartRegionToExactRegion(smartOrExactRegion: string) {
return smartRegionToExactRegionMap.get(smartOrExactRegion) ?? smartOrExactRegion
}
export function getAvailableRegions(cloudProvider: CloudProvider): Region {
switch (cloudProvider) {
case 'AWS':
case 'AWS_K8S':
return AWS_REGIONS
case 'AWS_NIMBUS':
// Only allow US East for Nimbus
return {
EAST_US: AWS_REGIONS.EAST_US,
}
case 'FLY':
return FLY_REGIONS
default:
throw new Error('Invalid cloud provider')
}
}