mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
* chore: limit regions for nimbus * fix logic * Autoselect east US if cloud provider is nimbus --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
30 lines
841 B
TypeScript
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')
|
|
}
|
|
}
|