Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ func Execute() {
if err != nil {
fmt.Fprintln(utils.GetDebugLogger(), err)
}
if semver.Compare(version, "v"+utils.Version) > 0 {
fmt.Fprintln(os.Stderr, suggestUpgrade(version))
}
if len(utils.CmdSuggestion) > 0 {
fmt.Fprintln(os.Stderr, utils.CmdSuggestion)
}
if semver.Compare(version, "v"+utils.Version) > 0 {
fmt.Fprintln(os.Stderr, suggestUpgrade(version))
}
}

func checkUpgrade(ctx context.Context, fsys afero.Fs) (string, error) {
Expand Down
18 changes: 4 additions & 14 deletions internal/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"os"
"reflect"
"slices"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -100,6 +99,10 @@ func Run(ctx context.Context, names CustomName, format string, fsys afero.Fs) er
if len(stopped) > 0 {
fmt.Fprintln(os.Stderr, "Stopped services:", stopped)
}
// Set suggestion to use new keys instead of deprecated ones
if utils.Config.Auth.Enabled && !slices.Contains(stopped, utils.GotrueId) && !slices.Contains(stopped, utils.ShortContainerImageName(utils.Config.Auth.Image)) {
utils.CmdSuggestion = utils.Orange("Please use publishable and secret key instead of anon and service role key.")
}
if format == utils.OutputPretty {
fmt.Fprintf(os.Stderr, "%s local development setup is running.\n\n", utils.Aqua("supabase"))
PrettyPrint(os.Stdout, stopped...)
Expand Down Expand Up @@ -230,24 +233,11 @@ func PrettyPrint(w io.Writer, exclude ...string) {
}
values := names.toValues(exclude...)
// Iterate through map in order of declared struct fields
t := reflect.TypeOf(names)
val := reflect.ValueOf(names)
for i := 0; i < val.NumField(); i++ {
k := val.Field(i).String()
if tag := t.Field(i).Tag.Get("env"); isDeprecated(tag) {
continue
}
if v, ok := values[k]; ok {
fmt.Fprintf(w, "%s: %s\n", k, v)
}
}
}

func isDeprecated(tag string) bool {
for part := range strings.SplitSeq(tag, ",") {
if strings.EqualFold(part, "deprecated") {
return true
}
}
return false
}
4 changes: 4 additions & 0 deletions internal/utils/colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ func Yellow(str string) string {
return lipgloss.NewStyle().Foreground(lipgloss.Color("11")).Render(str)
}

func Orange(str string) string {
return lipgloss.NewStyle().Foreground(lipgloss.Color("214")).Render(str)
}

// For errors.
func Red(str string) string {
return lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Render(str)
Expand Down