From 024d247a7bde62d861597d2ae2c4a014b0c602f2 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 3 Apr 2024 16:09:06 +0800 Subject: [PATCH] fix: add scheme to supabase url for bootstrap (#2115) --- internal/bootstrap/bootstrap.go | 2 +- internal/bootstrap/bootstrap_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go index ac9279bb8..68832b076 100644 --- a/internal/bootstrap/bootstrap.go +++ b/internal/bootstrap/bootstrap.go @@ -213,7 +213,7 @@ func writeDotEnv(keys []api.ApiKeyResponse, config pgconn.Config, fsys afero.Fs) transactionMode := *config.Copy() transactionMode.Port = 6543 initial := map[string]string{ - SUPABASE_URL: utils.GetSupabaseHost(flags.ProjectRef), + SUPABASE_URL: "https://" + utils.GetSupabaseHost(flags.ProjectRef), POSTGRES_URL: utils.ToPostgresURL(transactionMode), } for _, entry := range keys { diff --git a/internal/bootstrap/bootstrap_test.go b/internal/bootstrap/bootstrap_test.go index 082153b4f..34661e9d9 100644 --- a/internal/bootstrap/bootstrap_test.go +++ b/internal/bootstrap/bootstrap_test.go @@ -75,7 +75,7 @@ func TestWriteEnv(t *testing.T) { assert.Equal(t, `POSTGRES_URL="postgresql://admin:password@db.supabase.co:6543/postgres?connect_timeout=10" SUPABASE_ANON_KEY="anonkey" SUPABASE_SERVICE_ROLE_KEY="servicekey" -SUPABASE_URL="testing.supabase.co"`, string(env)) +SUPABASE_URL="https://testing.supabase.co"`, string(env)) }) t.Run("merges with .env.example", func(t *testing.T) { @@ -106,7 +106,7 @@ SUPABASE_URL="testing.supabase.co"`, string(env)) env, err := afero.ReadFile(fsys, ".env") assert.NoError(t, err) assert.Equal(t, `NEXT_PUBLIC_SUPABASE_ANON_KEY="anonkey" -NEXT_PUBLIC_SUPABASE_URL="testing.supabase.co" +NEXT_PUBLIC_SUPABASE_URL="https://testing.supabase.co" POSTGRES_DATABASE="postgres" POSTGRES_HOST="db.supabase.co" POSTGRES_PASSWORD="password" @@ -116,7 +116,7 @@ POSTGRES_URL_NON_POOLING="postgresql://admin:password@db.supabase.co:5432/postgr POSTGRES_USER="admin" SUPABASE_ANON_KEY="anonkey" SUPABASE_SERVICE_ROLE_KEY="servicekey" -SUPABASE_URL="testing.supabase.co" +SUPABASE_URL="https://testing.supabase.co" no_match="example"`, string(env)) })