mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-10 17:26:38 +08:00
fix(storage): apply driver switch on save and repoint upload records
Saving storage settings now activates the selected driver immediately
instead of staging it until migration. When the driver changes, existing
upload rows are repointed to the new storage_driver so /f/{id} reads use
the correct backend. ForDriver can also open non-active drivers from the
saved multi-backend config.
This commit is contained in:
@@ -168,10 +168,11 @@ func ForDriver(ctx context.Context, driver Driver) (Backend, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if cfg.Driver == driver {
|
||||
return NewBackend(ctx, cfg, driver)
|
||||
backend, err := NewBackend(ctx, cfg, driver)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("storage configuration for driver %q is unavailable: %w", driver, err)
|
||||
}
|
||||
return nil, fmt.Errorf("storage configuration for driver %q is unavailable", driver)
|
||||
return backend, nil
|
||||
}
|
||||
|
||||
type functionBackend struct {
|
||||
|
||||
Reference in New Issue
Block a user