From f12bb1b4788407359030692326687696c21cc09d Mon Sep 17 00:00:00 2001 From: Francis Chuang Date: Tue, 26 Mar 2024 10:33:22 +1100 Subject: [PATCH] Invalidate client after rotating root credentials --- backend.go | 2 +- path_config_rotate.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend.go b/backend.go index 97ef5a9..770a330 100644 --- a/backend.go +++ b/backend.go @@ -88,7 +88,7 @@ func (b *backblazeB2Backend) reset() { } func (b *backblazeB2Backend) invalidate(_ context.Context, key string) { - if key == "config" { + if key == configStoragePath { b.reset() } } diff --git a/path_config_rotate.go b/path_config_rotate.go index 0646128..132e064 100644 --- a/path_config_rotate.go +++ b/path_config_rotate.go @@ -73,6 +73,8 @@ func (b *backblazeB2Backend) pathConfigRotateRootUpdate(ctx context.Context, req return nil, fmt.Errorf("failed to generate JSON configuration: %w", err) } + b.reset() + // And store it if err := req.Storage.Put(ctx, entry); err != nil { return nil, fmt.Errorf("failed to persist configuration: %w", err)