Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

enforce APSE1 for projects on staging

Francisco Mazzoni4d2b7699473f
diff --git a/studio/lib/constants/infrastructure.ts b/studio/lib/constants/infrastructure.ts
index d9a7f5a5475..add3dec7fdd 100644
--- a/studio/lib/constants/infrastructure.ts
+++ b/studio/lib/constants/infrastructure.ts
@@ -18,7 +18,8 @@ export const REGIONS = {
// SOUTH_AFRICA: 'South Africa (Cape Town)',
}
-export const REGIONS_DEFAULT = REGIONS.EAST_US
+export const REGIONS_DEFAULT =
+ process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging' ? REGIONS.SOUTHEAST_ASIA : REGIONS.EAST_US
export const PRICING_TIER_LABELS = {
FREE: 'Free',
diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx
index c32a1820e91..359aad2bc6a 100644
--- a/studio/pages/new/[slug].tsx
+++ b/studio/pages/new/[slug].tsx
@@ -11,7 +11,7 @@ import generator from 'generate-password'
import { Button, Listbox, IconUsers, Input, IconLoader, Alert } from '@supabase/ui'
import { NextPageWithLayout } from 'types'
-import { passwordStrength } from 'lib/helpers'
+import { passwordStrength, pluckObjectFields } from 'lib/helpers'
import { get, post } from 'lib/common/fetch'
import {
API_URL,
@@ -61,6 +61,7 @@ const Wizard: NextPageWithLayout = () => {
const totalFreeProjects = subscriptionStats.total_active_free_projects
const freeProjectsLimit = ui.profile?.free_project_limit ?? DEFAULT_FREE_PROJECTS_LIMIT
+ const availableRegions = getAvailableRegions()
const isOrganizationOwner = currentOrg?.is_owner || !app.organizations.isInitialized
const isEmptyOrganizations = organizations.length <= 0 && app.organizations.isInitialized
@@ -187,6 +188,13 @@ const Wizard: NextPageWithLayout = () => {
delayedCheckPasswordStrength(password)
}
+ // [Fran] Enforce APSE1 region on staging
+ function getAvailableRegions() {
+ return process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'
+ ? pluckObjectFields(REGIONS, ['SOUTHEAST_ASIA'])
+ : REGIONS
+ }
+
return (
<Panel
hideHeaderStyling
@@ -301,8 +309,8 @@ const Wizard: NextPageWithLayout = () => {
onChange={(value: string) => onDbRegionChange(value)}
descriptionText="Select a region close to you for the best performance."
>
- {Object.keys(REGIONS).map((option: string, i) => {
- const label = Object.values(REGIONS)[i]
+ {Object.keys(availableRegions).map((option: string, i) => {
+ const label = Object.values(availableRegions)[i] as string
return (
<Listbox.Option
key={option}
@@ -311,7 +319,7 @@ const Wizard: NextPageWithLayout = () => {
addOnBefore={({ active, selected }: any) => (
<img
className="w-5 rounded-sm"
- src={`/img/regions/${Object.keys(REGIONS)[i]}.svg`}
+ src={`/img/regions/${Object.keys(availableRegions)[i]}.svg`}
/>
)}
>