From 84d1fab8a9a7c253e65ff80883c8fa409e951048 Mon Sep 17 00:00:00 2001 From: DE OLIVEIRA Tristan Date: Sun, 9 Jan 2022 03:23:02 +0100 Subject: [PATCH] feat: add support for custom url on api pages --- studio/lib/gotrue.ts | 2 +- studio/pages/api/props/project/[ref]/api.ts | 12 ++++++------ studio/pages/api/props/project/[ref]/settings.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/studio/lib/gotrue.ts b/studio/lib/gotrue.ts index cbdfdf1772b..5a711db5152 100644 --- a/studio/lib/gotrue.ts +++ b/studio/lib/gotrue.ts @@ -1,6 +1,6 @@ import { GoTrueClient, User } from '@supabase/gotrue-js' -export const GOTRUE_URL = process.env.NEXT_PUBLIC_GOTRUE_URL || 'http://localhost:8000/auth/v1' +export const GOTRUE_URL = process.env.NEXT_PUBLIC_GOTRUE_URL || `${process.env.SUPABASE_URL}/auth/v1` export const auth = new GoTrueClient({ url: GOTRUE_URL, diff --git a/studio/pages/api/props/project/[ref]/api.ts b/studio/pages/api/props/project/[ref]/api.ts index efc2e2efacf..0c74cfb40f5 100644 --- a/studio/pages/api/props/project/[ref]/api.ts +++ b/studio/pages/api/props/project/[ref]/api.ts @@ -38,11 +38,11 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => { app: { id: 1, name: 'Auto API' }, app_config: { db_schema: 'public', - endpoint: 'localhost:8000', + endpoint: process.env.SUPABASE_URL, realtime_enabled: true, }, - endpoint: 'http://localhost:8000', - restUrl: 'http://localhost:8000/rest/v1/', + endpoint: process.env.SUPABASE_URL, + restUrl: `${process.env.SUPABASE_URL}/rest/v1/`, defaultApiKey: process.env.SUPABASE_ANON_KEY, serviceApiKey: process.env.SUPABASE_SERVICE_KEY, internalApiKey: process.env.SUPABASE_ANON_KEY, @@ -68,11 +68,11 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => { app: { id: 1, name: 'Auto API' }, app_config: { db_schema: 'public', - endpoint: 'localhost:8000', + endpoint: process.env.SUPABASE_URL, realtime_enabled: true, }, - endpoint: 'http://localhost:8000', - restUrl: 'http://localhost:8000/rest/v1/', + endpoint: process.env.SUPABASE_URL, + restUrl: `${process.env.SUPABASE_URL}/rest/v1/`, defaultApiKey: process.env.SUPABASE_ANON_KEY, serviceApiKey: process.env.SUPABASE_SERVICE_KEY, internalApiKey: process.env.SUPABASE_ANON_KEY, diff --git a/studio/pages/api/props/project/[ref]/settings.ts b/studio/pages/api/props/project/[ref]/settings.ts index 40a18f06462..a5ed9be25e9 100644 --- a/studio/pages/api/props/project/[ref]/settings.ts +++ b/studio/pages/api/props/project/[ref]/settings.ts @@ -55,7 +55,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => { app: { id: 1, name: 'Auto API' }, app_config: { db_schema: 'public', - endpoint: 'localhost:8000', + endpoint: process.env.SUPABASE_URL, realtime_enabled: true, }, },