Skip to content

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

fix(studio): studio broken local/self-hosted pages 1 (database settings) (#40579)

Kalleby Santosb74bf9bef49b
diff --git a/apps/studio/components/interfaces/Settings/Database/SettingsDatabaseEmptyStateLocal.tsx b/apps/studio/components/interfaces/Settings/Database/SettingsDatabaseEmptyStateLocal.tsx
new file mode 100644
index 00000000000..b089eaca41d
--- /dev/null
+++ b/apps/studio/components/interfaces/Settings/Database/SettingsDatabaseEmptyStateLocal.tsx
@@ -0,0 +1,55 @@
+import { Card, CardContent, CardHeader } from 'ui'
+import { DOCS_URL } from 'lib/constants'
+import { DocsButton } from 'components/ui/DocsButton'
+
+export function SettingsDatabaseEmptyStateLocal() {
+ return (
+ <>
+ <Card>
+ <CardHeader className="flex-row items-center justify-between">
+ Local development & CLI
+ <div className="flex items-center gap-x-2">
+ <DocsButton href={`${DOCS_URL}/guides/local-development/cli/config#database-config`} />
+ </div>
+ </CardHeader>
+ <CardContent>
+ <p className="prose [&>code]:text-xs text-sm max-w-full">
+ Change settings in <code>supabase/config.toml</code> file, which is automatically loaded
+ on <code>supabase start</code>
+ </p>
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader className="flex-row items-center justify-between">
+ Self-Hosted Supabase
+ <div className="flex items-center gap-x-2">
+ <DocsButton
+ href={`${DOCS_URL}/guides/self-hosting/docker#configuring-and-securing-supabase`}
+ />
+ </div>
+ </CardHeader>
+ <CardContent>
+ <p className="prose [&>code]:text-xs space-x-1 text-sm max-w-full">
+ <span>Change settings in</span>
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://github.com/supabase/supabase/blob/master/docker/.env.example"
+ >
+ .env file
+ </a>
+ <span>and</span>
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml"
+ >
+ docker-compose.yml
+ </a>
+ </p>
+ </CardContent>
+ </Card>
+ </>
+ )
+}
diff --git a/apps/studio/pages/project/[ref]/database/settings.tsx b/apps/studio/pages/project/[ref]/database/settings.tsx
index 4be4dd1850d..a069ae05469 100644
--- a/apps/studio/pages/project/[ref]/database/settings.tsx
+++ b/apps/studio/pages/project/[ref]/database/settings.tsx
@@ -1,4 +1,5 @@
import dynamic from 'next/dynamic'
+import { IS_PLATFORM } from 'lib/constants'
import { ConnectionPooling } from 'components/interfaces/Settings/Database/ConnectionPooling/ConnectionPooling'
import { DatabaseReadOnlyAlert } from 'components/interfaces/Settings/Database/DatabaseReadOnlyAlert'
import ResetDbPassword from 'components/interfaces/Settings/Database/DatabaseSettings/ResetDbPassword'
@@ -16,6 +17,7 @@ import {
} from 'ui-patterns/PageHeader'
import { PageSection, PageSectionContent } from 'ui-patterns/PageSection'
import type { NextPageWithLayout } from 'types'
+import { SettingsDatabaseEmptyStateLocal } from 'components/interfaces/Settings/Database/SettingsDatabaseEmptyStateLocal'
const SSLConfiguration = dynamic(
() => import('components/interfaces/Settings/Database/SSLConfiguration')
@@ -50,25 +52,37 @@ const ProjectSettings: NextPageWithLayout = () => {
</PageHeaderSummary>
</PageHeaderMeta>
</PageHeader>
- <PageContainer className="pb-12">
- <PageSection>
- <PageSectionContent className="space-y-4 md:space-y-8">
- <DatabaseReadOnlyAlert />
- <ResetDbPassword />
- <ConnectionPooling />
- </PageSectionContent>
- </PageSection>
- <SSLConfiguration />
- {showNewDiskManagementUI ? (
- // This form is hidden if Disk and Compute form is enabled, new form is on ./settings/compute-and-disk
- <DiskManagementPanelForm />
- ) : (
- <DiskSizeConfiguration />
- )}
- {databaseNetworkRestrictions && <NetworkRestrictions />}
- <BannedIPs />
- </PageContainer>
- <PoolingModesModal />
+ {IS_PLATFORM ? (
+ <>
+ <PageContainer className="pb-12">
+ <PageSection>
+ <PageSectionContent className="space-y-4 md:space-y-8">
+ <DatabaseReadOnlyAlert />
+ <ResetDbPassword />
+ <ConnectionPooling />
+ </PageSectionContent>
+ </PageSection>
+ <SSLConfiguration />
+ {showNewDiskManagementUI ? (
+ // This form is hidden if Disk and Compute form is enabled, new form is on ./settings/compute-and-disk
+ <DiskManagementPanelForm />
+ ) : (
+ <DiskSizeConfiguration />
+ )}
+ {databaseNetworkRestrictions && <NetworkRestrictions />}
+ <BannedIPs />
+ </PageContainer>
+ <PoolingModesModal />
+ </>
+ ) : (
+ <PageContainer className="pb-12">
+ <PageSection>
+ <PageSectionContent className="space-y-4 md:space-y-8">
+ <SettingsDatabaseEmptyStateLocal />
+ </PageSectionContent>
+ </PageSection>
+ </PageContainer>
+ )}
</>
)
}