mirror of
https://github.com/supabase/supabase.git
synced 2026-07-06 03:04:20 +08:00
* docs: add smart regions list mapping * docs: add smart region selection docs * Update apps/docs/content/guides/platform/regions.mdx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update apps/docs/content/guides/platform/regions.mdx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
25 lines
741 B
TypeScript
25 lines
741 B
TypeScript
import type { CloudProvider, Region } from 'shared-data'
|
|
import { AWS_REGIONS, FLY_REGIONS } from 'shared-data'
|
|
import { SMART_REGION_TO_EXACT_REGION_MAP } from 'shared-data/regions'
|
|
|
|
export function smartRegionToExactRegion(smartOrExactRegion: string) {
|
|
return SMART_REGION_TO_EXACT_REGION_MAP.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')
|
|
}
|
|
}
|