1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

storage: fail startup if unable to create file store dir (#448)

Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
James Hillyerd
2023-11-28 15:09:17 -08:00
committed by GitHub
parent c1d5d49126
commit 043551343c

View File

@@ -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,