-
Notifications
You must be signed in to change notification settings - Fork 346
feat(cli): add --no-seed flag to supabase start #4707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat(cli): add --no-seed flag to supabase start #4707
Conversation
Pull Request Test Coverage Report for Build 20892845078Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
Is it not sufficient to use config.toml to turn off seeding? [db.seed]
enabled = false |
|
Good question. |
|
Hi @sweatybridge Just to confirm, should storage seeding fully follow If that works for you, I’ll update the implementation and push a follow-up commit. |
Generally I'd avoid adding more flags because it's hard to maintain. But I agree My only suggestion is to reuse the noSeed variable instead of declaring a new one. And yes, let's have storage seeding follow |
|
That makes sense I’ll reuse the existing I’ll push a follow-up commit with these changes shortly. |
|
@sweatybridge I’ve updated storage seeding to follow db.seed.enabled by default, with --no-seed acting as a CLI override. |
sweatybridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for creating this PR. I just want to suggest a minor change. Don't worry if you are busy because I can also pick it up next week.
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| validateExcludedContainers(excludedContainers) | ||
| return start.Run(cmd.Context(), afero.NewOsFs(), excludedContainers, ignoreHealthCheck) | ||
| return start.Run(cmd.Context(), afero.NewOsFs(), excludedContainers, ignoreHealthCheck, skipSeed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return start.Run(cmd.Context(), afero.NewOsFs(), excludedContainers, ignoreHealthCheck, skipSeed) | |
| fsys := afero.NewOsFs() | |
| if err := flags.LoadConfig(fsys); err != nil { | |
| return err | |
| } | |
| if noSeed { | |
| utils.Config.Db.Seed.Enabled = false | |
| } | |
| return start.Run(cmd.Context(), fsys, excludedContainers, ignoreHealthCheck) |
I'd suggest we apply an override to the loaded config struct similar to https://github.com/supabase/cli/blob/develop/cmd/db.go#L200-L202
|
|
||
| // Follow db.seed.enabled by default, allow --no-seed as override | ||
| if skipSeed { | ||
| fmt.Fprintln(os.Stderr, "Skipping storage seeding (--no-seed enabled)") | ||
| } else if !utils.Config.Db.Seed.Enabled { | ||
| fmt.Fprintln(os.Stderr, "Skipping storage seeding (db.seed.enabled = false)") | ||
| } else { | ||
| if err := buckets.Run(ctx, "", false, fsys); err != nil { | ||
| return err | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Follow db.seed.enabled by default, allow --no-seed as override | |
| if skipSeed { | |
| fmt.Fprintln(os.Stderr, "Skipping storage seeding (--no-seed enabled)") | |
| } else if !utils.Config.Db.Seed.Enabled { | |
| fmt.Fprintln(os.Stderr, "Skipping storage seeding (db.seed.enabled = false)") | |
| } else { | |
| if err := buckets.Run(ctx, "", false, fsys); err != nil { | |
| return err | |
| } | |
| } | |
| if !utils.Config.Db.Seed.Enabled { | |
| fmt.Fprintln(os.Stderr, "Skipping storage seeding...") | |
| } else if err := buckets.Run(ctx, "", false, fsys); err != nil { | |
| return err | |
| } |
Adds a --no-seed flag to supabase start to skip storage bucket seeding during startup.
This allows faster restarts and avoids unnecessary seeding when it’s not needed.
Default behavior remains unchanged when the flag is not used.