• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 18558080767

16 Oct 2025 10:20AM UTC coverage: 54.579% (-0.008%) from 54.587%
18558080767

Pull #4319

github

web-flow
Merge 73845860d into af399f974
Pull Request #4319: feat: add flag to skip linking pooler

23 of 29 new or added lines in 4 files covered. (79.31%)

7 existing lines in 2 files now uncovered.

6389 of 11706 relevant lines covered (54.58%)

6.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/link.go
1
package cmd
2

3
import (
4
        "os"
5
        "os/signal"
6

7
        "github.com/spf13/afero"
8
        "github.com/spf13/cobra"
9
        "github.com/spf13/viper"
10
        "github.com/supabase/cli/internal/link"
11
        "github.com/supabase/cli/internal/utils/flags"
12
        "golang.org/x/term"
13
)
14

15
var (
16
        skipPooler bool
17

18
        linkCmd = &cobra.Command{
19
                GroupID: groupLocalDev,
20
                Use:     "link",
21
                Short:   "Link to a Supabase project",
22
                PreRunE: func(cmd *cobra.Command, args []string) error {
×
23
                        if !term.IsTerminal(int(os.Stdin.Fd())) && !viper.IsSet("PROJECT_ID") {
×
24
                                return cmd.MarkFlagRequired("project-ref")
×
25
                        }
×
26
                        return nil
×
27
                },
28
                RunE: func(cmd *cobra.Command, args []string) error {
×
29
                        ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
×
30
                        // Use an empty fs to skip loading from file
×
31
                        if err := flags.ParseProjectRef(ctx, afero.NewMemMapFs()); err != nil {
×
32
                                return err
×
33
                        }
×
34
                        fsys := afero.NewOsFs()
×
35
                        if err := flags.LoadConfig(fsys); err != nil {
×
36
                                return err
×
37
                        }
×
38
                        // TODO: move this to root cmd
39
                        cobra.CheckErr(viper.BindPFlag("DB_PASSWORD", cmd.Flags().Lookup("password")))
×
NEW
40
                        return link.Run(ctx, flags.ProjectRef, skipPooler, fsys)
×
41
                },
42
        }
43
)
44

45
func init() {
×
46
        linkFlags := linkCmd.Flags()
×
47
        linkFlags.StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
×
48
        linkFlags.StringVarP(&dbPassword, "password", "p", "", "Password to your remote Postgres database.")
×
NEW
49
        linkFlags.BoolVar(&skipPooler, "skip-pooler", false, "Use direct connection instead of pooler.")
×
50
        // For some reason, BindPFlag only works for StringVarP instead of StringP
×
51
        rootCmd.AddCommand(linkCmd)
×
52
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc