Skip to content

Commit

Permalink
fix(config): resolve objects path when loading buckets config
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Oct 29, 2024
1 parent 074cbb6 commit bf9f40e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 1 addition & 10 deletions internal/seed/buckets/buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ package buckets
import (
"context"
"fmt"
"path/filepath"

"github.com/spf13/afero"
"github.com/supabase/cli/internal/storage/client"
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/pkg/config"
)

func Run(ctx context.Context, projectRef string, interactive bool, fsys afero.Fs) error {
Expand All @@ -31,12 +29,5 @@ func Run(ctx context.Context, projectRef string, interactive bool, fsys afero.Fs
if err := api.UpsertBuckets(ctx, utils.Config.Storage.Buckets, filter); err != nil {
return err
}
resolved := config.BucketConfig{}
for name, bucket := range utils.Config.Storage.Buckets {
if len(bucket.ObjectsPath) > 0 && !filepath.IsAbs(bucket.ObjectsPath) {
bucket.ObjectsPath = filepath.Join(utils.SupabaseDirPath, bucket.ObjectsPath)
}
resolved[name] = bucket
}
return api.UpsertObjects(ctx, resolved, utils.NewRootFS(fsys))
return api.UpsertObjects(ctx, utils.Config.Storage.Buckets, utils.NewRootFS(fsys))
}
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ func (c *config) Load(path string, fsys fs.FS) error {
if bucket.FileSizeLimit == 0 {
bucket.FileSizeLimit = c.Storage.FileSizeLimit
}
if len(bucket.ObjectsPath) > 0 && !filepath.IsAbs(bucket.ObjectsPath) {
bucket.ObjectsPath = filepath.Join(builder.SupabaseDirPath, bucket.ObjectsPath)
}
c.Storage.Buckets[name] = bucket
}
for slug, function := range c.Functions {
Expand Down

0 comments on commit bf9f40e

Please sign in to comment.