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:
@@ -58,12 +58,14 @@ func New(cfg config.Storage, extHost *extension.Host) (storage.Store, error) {
|
|||||||
}
|
}
|
||||||
mailPath := filepath.Join(path, "mail")
|
mailPath := filepath.Join(path, "mail")
|
||||||
if _, err := os.Stat(mailPath); err != nil {
|
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 {
|
if err = os.MkdirAll(mailPath, 0770); err != nil {
|
||||||
log.Error().Str("module", "storage").Str("path", mailPath).Err(err).
|
log.Error().Str("module", "storage").Str("path", mailPath).Err(err).
|
||||||
Msg("Error creating dir")
|
Msg("Error creating dir")
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Store{
|
return &Store{
|
||||||
path: path,
|
path: path,
|
||||||
mailPath: mailPath,
|
mailPath: mailPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user