mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
When high availability is enabled during project creation, automatically switch to AWS (Revamped) and disable other cloud providers – multigres/HA is only supported on v3. <img width="778" height="390" alt="Screenshot 2026-04-06 at 5 09 55 PM" src="https://github.com/user-attachments/assets/c458f345-497e-4963-9c2f-b4b1eafd030b" /> **Changed:** - Cloud provider selector now watches `highAvailability` form state - Non-`AWS_K8S` providers (Fly.io, AWS, AWS Nimbus) are disabled when HA is on - Warning description shown in orange when HA restricts the provider choice **Added:** - `useEffect` in project creation form to auto-switch cloud provider to `AWS_K8S` when HA is toggled on ## To test - Enable the HA toggle on the new project page (requires `instances.high_availability` entitlement) - Verify cloud provider auto-switches to AWS (Revamped) - Verify other providers are greyed out in the dropdown - Verify orange warning text appears below the cloud provider label - Toggle HA off and confirm all providers become selectable again - Ensure project creation still works for both HA and non-HA projects <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * When high availability is enabled, cloud provider selection is restricted to AWS. * A warning appears when high availability is enabled, noting AWS-only support. * The cloud provider selection automatically switches to AWS if high availability is toggled on. * **Bug Fixes** * Improved form validation to prevent incompatible high-availability and provider combinations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
import { DEFAULT_MINIMUM_PASSWORD_STRENGTH } from '@/lib/constants'
|
|
|
|
export const FormSchema = z
|
|
.object({
|
|
organization: z.string({
|
|
required_error: 'Please select an organization',
|
|
}),
|
|
projectName: z
|
|
.string()
|
|
.trim()
|
|
.min(1, 'Please enter a project name.') // Required field check
|
|
.min(3, 'Project name must be at least 3 characters long.') // Minimum length check
|
|
.max(64, 'Project name must be no longer than 64 characters.'), // Maximum length check
|
|
highAvailability: z.boolean(),
|
|
postgresVersion: z.string({
|
|
required_error: 'Please enter a Postgres version.',
|
|
}),
|
|
dbRegion: z.string({
|
|
required_error: 'Please select a region.',
|
|
}),
|
|
cloudProvider: z.string({
|
|
required_error: 'Please select a cloud provider.',
|
|
}),
|
|
|
|
dbPass: z
|
|
.string({ required_error: 'Please enter a database password.' })
|
|
.min(1, 'Password is required.'),
|
|
dbPassStrength: z
|
|
.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
|
|
.default(0),
|
|
dbPassStrengthMessage: z.string().default(''),
|
|
dbPassStrengthWarning: z.string().default(''),
|
|
instanceSize: z.string().optional(),
|
|
dataApi: z.boolean(),
|
|
enableRlsEventTrigger: z.boolean(),
|
|
postgresVersionSelection: z.string(),
|
|
useOrioleDb: z.boolean(),
|
|
})
|
|
.superRefine(
|
|
({ dbPassStrength, dbPassStrengthWarning, highAvailability, cloudProvider }, ctx) => {
|
|
if (dbPassStrength < DEFAULT_MINIMUM_PASSWORD_STRENGTH) {
|
|
ctx.addIssue({
|
|
code: z.ZodIssueCode.custom,
|
|
path: ['dbPass'],
|
|
message: dbPassStrengthWarning || 'Password not secure enough',
|
|
})
|
|
}
|
|
if (highAvailability && cloudProvider !== 'AWS_K8S') {
|
|
ctx.addIssue({
|
|
code: z.ZodIssueCode.custom,
|
|
path: ['cloudProvider'],
|
|
message: 'High availability is only supported on AWS (Revamped)',
|
|
})
|
|
}
|
|
}
|
|
)
|
|
|
|
export type CreateProjectForm = z.infer<typeof FormSchema>
|