Skip to content

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

chore: Hide the settings page on self-hosted / CLI

gitstart9e82c045084c
diff --git a/studio/next.config.js b/studio/next.config.js
index 0684e797af3..3ac852ca38c 100644
--- a/studio/next.config.js
+++ b/studio/next.config.js
@@ -12,105 +12,132 @@ const withTM = require('next-transpile-modules')(['ui', 'common'])
// https://nextjs.org/docs/api-reference/next.config.js/introduction
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
+const IS_PLATFORM = process.env.NEXT_PUBLIC_IS_PLATFORM === 'true'
+
+// Fixes the issue with the user having direct URL access to these pages in non-platform environments,
+// by redirecting to the respective available page.
+const nonPlatformRedirects = [
+ {
+ source: '/project/:ref/auth/providers',
+ destination: '/project/:ref/auth/users',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/auth/templates',
+ destination: '/project/:ref/auth/users',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/auth/url-configuration',
+ destination: '/project/:ref/auth/users',
+ permanent: true,
+ },
+]
+
+const generalRedirects = [
+ {
+ source: '/',
+ destination: '/sign-in',
+ permanent: false,
+ },
+ {
+ source: '/register',
+ destination: '/sign-up',
+ permanent: false,
+ },
+ {
+ source: '/signup',
+ destination: '/sign-up',
+ permanent: false,
+ },
+ {
+ source: '/signin',
+ destination: '/sign-in',
+ permanent: false,
+ },
+ {
+ source: '/login',
+ destination: '/sign-in',
+ permanent: false,
+ },
+ {
+ source: '/log-in',
+ destination: '/sign-in',
+ permanent: false,
+ },
+ {
+ source: '/project/:ref/auth',
+ destination: '/project/:ref/auth/users',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/database',
+ destination: '/project/:ref/database/tables',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/storage',
+ destination: '/project/:ref/storage/buckets',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/settings',
+ destination: '/project/:ref/settings/general',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/auth/settings',
+ destination: '/project/:ref/auth/users',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/settings/billing',
+ destination: '/project/:ref/settings/billing/subscription',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/database/postgres-logs',
+ destination: '/project/:ref/logs/postgres-logs',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/database/postgrest-logs',
+ destination: '/project/:ref/logs/postgrest-logs',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/database/pgbouncer-logs',
+ destination: '/project/:ref/logs/pgbouncer-logs',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/database/realtime-logs',
+ destination: '/project/:ref/logs/realtime-logs',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/storage/logs',
+ destination: '/project/:ref/logs/storage-logs',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/auth/logs',
+ destination: '/project/:ref/logs/auth-logs',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/logs-explorer',
+ destination: '/project/:ref/logs/explorer',
+ permanent: true,
+ },
+]
+
const nextConfig = {
async redirects() {
- return [
- {
- source: '/',
- destination: '/sign-in',
- permanent: false,
- },
- {
- source: '/register',
- destination: '/sign-up',
- permanent: false,
- },
- {
- source: '/signup',
- destination: '/sign-up',
- permanent: false,
- },
- {
- source: '/signin',
- destination: '/sign-in',
- permanent: false,
- },
- {
- source: '/login',
- destination: '/sign-in',
- permanent: false,
- },
- {
- source: '/log-in',
- destination: '/sign-in',
- permanent: false,
- },
- {
- source: '/project/:ref/auth',
- destination: '/project/:ref/auth/users',
- permanent: true,
- },
- {
- source: '/project/:ref/database',
- destination: '/project/:ref/database/tables',
- permanent: true,
- },
- {
- source: '/project/:ref/storage',
- destination: '/project/:ref/storage/buckets',
- permanent: true,
- },
- {
- source: '/project/:ref/settings',
- destination: '/project/:ref/settings/general',
- permanent: true,
- },
- {
- source: '/project/:ref/auth/settings',
- destination: '/project/:ref/auth/users',
- permanent: true,
- },
- {
- source: '/project/:ref/settings/billing',
- destination: '/project/:ref/settings/billing/subscription',
- permanent: true,
- },
- {
- source: '/project/:ref/database/postgres-logs',
- destination: '/project/:ref/logs/postgres-logs',
- permanent: true,
- },
- {
- source: '/project/:ref/database/postgrest-logs',
- destination: '/project/:ref/logs/postgrest-logs',
- permanent: true,
- },
- {
- source: '/project/:ref/database/pgbouncer-logs',
- destination: '/project/:ref/logs/pgbouncer-logs',
- permanent: true,
- },
- {
- source: '/project/:ref/database/realtime-logs',
- destination: '/project/:ref/logs/realtime-logs',
- permanent: true,
- },
- {
- source: '/project/:ref/storage/logs',
- destination: '/project/:ref/logs/storage-logs',
- permanent: true,
- },
- {
- source: '/project/:ref/auth/logs',
- destination: '/project/:ref/logs/auth-logs',
- permanent: true,
- },
- {
- source: '/project/:ref/logs-explorer',
- destination: '/project/:ref/logs/explorer',
- permanent: true,
- },
- ]
+ if (!IS_PLATFORM) {
+ return [...nonPlatformRedirects, ...generalRedirects]
+ }
+ return generalRedirects
},
async headers() {
return [
@@ -162,7 +189,6 @@ const sentryWebpackPluginOptions = {
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
-module.exports =
- process.env.NEXT_PUBLIC_IS_PLATFORM === 'true'
- ? withSentryConfig(moduleExports, sentryWebpackPluginOptions)
- : withPlugins([withTM()], nextConfig)
+module.exports = IS_PLATFORM
+ ? withSentryConfig(moduleExports, sentryWebpackPluginOptions)
+ : withPlugins([withTM()], nextConfig)