From 043551343c46a6272afce689cc00cdf008afc2e7 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Tue, 28 Nov 2023 15:09:17 -0800 Subject: [PATCH] storage: fail startup if unable to create file store dir (#448) Signed-off-by: James Hillyerd --- pkg/storage/file/fstore.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/storage/file/fstore.go b/pkg/storage/file/fstore.go index fe934f0..b873533 100644 --- a/pkg/storage/file/fstore.go +++ b/pkg/storage/file/fstore.go @@ -58,12 +58,14 @@ func New(cfg config.Storage, extHost *extension.Host) (storage.Store, error) { } mailPath := filepath.Join(path, "mail") if _, err := os.Stat(mailPath); err != nil { - // Mail datastore does not yet exist + // Mail datastore does not yet exist, create it. if err = os.MkdirAll(mailPath, 0770); err != nil { log.Error().Str("module", "storage").Str("path", mailPath).Err(err). Msg("Error creating dir") + return nil, err } } + return &Store{ path: path, mailPath: mailPath,