Skip to content

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

Add flag for network restrictions section (#39161)

Joshen Lim2025acb30a01
diff --git a/apps/studio/components/interfaces/Settings/Database/NetworkRestrictions/NetworkRestrictions.tsx b/apps/studio/components/interfaces/Settings/Database/NetworkRestrictions/NetworkRestrictions.tsx
index 070aa1788e4..f138b40cc57 100644
--- a/apps/studio/components/interfaces/Settings/Database/NetworkRestrictions/NetworkRestrictions.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/NetworkRestrictions/NetworkRestrictions.tsx
@@ -67,7 +67,7 @@ const DisallowAllAccessButton = ({ disabled, onClick }: AccessButtonProps) => (
</ButtonTooltip>
)
-const NetworkRestrictions = () => {
+export const NetworkRestrictions = () => {
const { ref } = useParams()
const { data: project } = useSelectedProjectQuery()
const [isAddingAddress, setIsAddingAddress] = useState<undefined | 'IPv4' | 'IPv6'>()
@@ -300,5 +300,3 @@ const NetworkRestrictions = () => {
</>
)
}
-
-export default NetworkRestrictions
diff --git a/apps/studio/components/interfaces/Settings/Database/index.ts b/apps/studio/components/interfaces/Settings/Database/index.ts
index 0b38459d614..94970d9e985 100644
--- a/apps/studio/components/interfaces/Settings/Database/index.ts
+++ b/apps/studio/components/interfaces/Settings/Database/index.ts
@@ -1,2 +1 @@
export { ConnectionPooling } from './ConnectionPooling/ConnectionPooling'
-export { default as NetworkRestrictions } from './NetworkRestrictions/NetworkRestrictions'
diff --git a/apps/studio/pages/project/[ref]/database/settings.tsx b/apps/studio/pages/project/[ref]/database/settings.tsx
index 920d10470bd..aff7f37700b 100644
--- a/apps/studio/pages/project/[ref]/database/settings.tsx
+++ b/apps/studio/pages/project/[ref]/database/settings.tsx
@@ -1,14 +1,16 @@
import { DiskManagementPanelForm } from 'components/interfaces/DiskManagement/DiskManagementPanelForm'
-import { ConnectionPooling, NetworkRestrictions } from 'components/interfaces/Settings/Database'
+import { ConnectionPooling } from 'components/interfaces/Settings/Database'
import BannedIPs from 'components/interfaces/Settings/Database/BannedIPs'
import { DatabaseReadOnlyAlert } from 'components/interfaces/Settings/Database/DatabaseReadOnlyAlert'
import ResetDbPassword from 'components/interfaces/Settings/Database/DatabaseSettings/ResetDbPassword'
import DiskSizeConfiguration from 'components/interfaces/Settings/Database/DiskSizeConfiguration'
+import { NetworkRestrictions } from 'components/interfaces/Settings/Database/NetworkRestrictions/NetworkRestrictions'
import { PoolingModesModal } from 'components/interfaces/Settings/Database/PoolingModesModal'
import SSLConfiguration from 'components/interfaces/Settings/Database/SSLConfiguration'
import DatabaseLayout from 'components/layouts/DatabaseLayout/DatabaseLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { ScaffoldContainer, ScaffoldHeader, ScaffoldTitle } from 'components/layouts/Scaffold'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useIsAwsCloudProvider, useIsAwsK8sCloudProvider } from 'hooks/misc/useSelectedProject'
import type { NextPageWithLayout } from 'types'
@@ -18,6 +20,8 @@ const ProjectSettings: NextPageWithLayout = () => {
const showNewDiskManagementUI = isAws || isAwsK8s
+ const { databaseNetworkRestrictions } = useIsFeatureEnabled(['database:network_restrictions'])
+
return (
<>
<ScaffoldContainer>
@@ -40,7 +44,7 @@ const ProjectSettings: NextPageWithLayout = () => {
) : (
<DiskSizeConfiguration />
)}
- <NetworkRestrictions />
+ {databaseNetworkRestrictions && <NetworkRestrictions />}
<BannedIPs />
</div>
</ScaffoldContainer>
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index b681ee0f76e..af70a916a05 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -14,7 +14,6 @@
"authentication:attack_protection": true,
"authentication:advanced": true,
-
"authentication:show_email_phone_columns": true,
"authentication:show_manual_linking": true,
"authentication:show_provider_filter": true,
@@ -34,6 +33,7 @@
"database:replication": true,
"database:roles": true,
"database:restore_to_new_project": true,
+ "database:network_restrictions": true,
"docs:auth_architecture": true,
"docs:auth_configuration": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index 4ccdda87ffc..4ce98155c44 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -123,6 +123,10 @@
"type": "boolean",
"description": "Enable the restore to new project page under backups"
},
+ "database:network_restrictions": {
+ "type": "boolean",
+ "description": "Show the network restrictions setting under database settings"
+ },
"docs:auth_architecture": {
"type": "boolean",
@@ -406,6 +410,7 @@
"database:replication",
"database:roles",
"database:restore_to_new_project",
+ "database:network_restrictions",
"docs:auth_architecture",
"docs:auth_configuration",
"docs:auth_flows",