Skip to content

Commit

Permalink
fix: add scheme to supabase url for bootstrap (#2115)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Apr 3, 2024
1 parent 57f4d51 commit 024d247
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions internal/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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"
Expand All @@ -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))
})

Expand Down

0 comments on commit 024d247

Please sign in to comment.