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

supabase / cli / 19699968033

26 Nov 2025 10:07AM UTC coverage: 54.995% (-0.4%) from 55.403%
19699968033

Pull #4368

github

web-flow
Merge b6a3e01eb into 6558d59e6
Pull Request #4368: feat: add deploy command to push all changes to linked project

45 of 181 new or added lines in 10 files covered. (24.86%)

15 existing lines in 2 files now uncovered.

6705 of 12192 relevant lines covered (55.0%)

6.2 hits per line

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

65.22
/internal/config/push/push.go
1
package push
2

3
import (
4
        "context"
5
        "fmt"
6
        "os"
7

8
        "github.com/go-errors/errors"
9
        "github.com/spf13/afero"
10
        "github.com/supabase/cli/internal/utils"
11
        "github.com/supabase/cli/internal/utils/flags"
12
        "github.com/supabase/cli/pkg/config"
13
)
14

15
func Run(ctx context.Context, ref string, dryRun bool, fsys afero.Fs) error {
2✔
16
        if err := flags.LoadConfig(fsys); err != nil {
3✔
17
                return err
1✔
18
        }
1✔
19
        client := config.NewConfigUpdater(*utils.GetSupabase())
1✔
20
        remote, err := utils.Config.GetRemoteByProjectRef(ref)
1✔
21
        if err != nil {
2✔
22
                // Use base config when no remote is declared
1✔
23
                remote.ProjectId = ref
1✔
24
        }
1✔
25
        cost, err := getCostMatrix(ctx, ref)
1✔
26
        if err != nil {
2✔
27
                return err
1✔
28
        }
1✔
NEW
29
        fmt.Fprintln(os.Stderr, "Checking config for project:", remote.ProjectId)
×
30
        console := utils.NewConsole()
×
31
        keep := func(name string) bool {
×
NEW
32
                if dryRun {
×
NEW
33
                        return false
×
NEW
34
                }
×
35
                title := fmt.Sprintf("Do you want to push %s config to remote?", name)
×
36
                if item, exists := cost[name]; exists {
×
37
                        title = fmt.Sprintf("Enabling %s will cost you %s. Keep it enabled?", item.Name, item.Price)
×
38
                }
×
39
                shouldPush, err := console.PromptYesNo(ctx, title, true)
×
40
                if err != nil {
×
41
                        fmt.Fprintln(os.Stderr, err)
×
42
                }
×
43
                return shouldPush
×
44
        }
45
        return client.UpdateRemoteConfig(ctx, remote, keep)
×
46
}
47

48
type CostItem struct {
49
        Name  string
50
        Price string
51
}
52

53
func getCostMatrix(ctx context.Context, projectRef string) (map[string]CostItem, error) {
3✔
54
        resp, err := utils.GetSupabase().V1ListProjectAddonsWithResponse(ctx, projectRef)
3✔
55
        if err != nil {
4✔
56
                return nil, errors.Errorf("failed to list addons: %w", err)
1✔
57
        } else if resp.JSON200 == nil {
4✔
58
                return nil, errors.Errorf("unexpected list addons status %d: %s", resp.StatusCode(), string(resp.Body))
1✔
59
        }
1✔
60
        costMatrix := make(map[string]CostItem, len(resp.JSON200.AvailableAddons))
1✔
61
        for _, addon := range resp.JSON200.AvailableAddons {
3✔
62
                if len(addon.Variants) == 1 {
4✔
63
                        costMatrix[string(addon.Type)] = CostItem{
2✔
64
                                Name:  addon.Variants[0].Name,
2✔
65
                                Price: addon.Variants[0].Price.Description,
2✔
66
                        }
2✔
67
                }
2✔
68
        }
69
        return costMatrix, nil
1✔
70
}
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