Fix data directory not creating on first run

This commit is contained in:
Marco Realacci 2022-12-22 16:40:57 +01:00
parent ec0b06affc
commit 7543fd36e0
3 changed files with 16 additions and 7 deletions

View file

@ -120,6 +120,14 @@ func run() error {
logger.WithError(err).Error("error creating the API server instance")
return fmt.Errorf("creating the API server instance: %w", err)
}
// Create the directories if they don't exist
if err := os.MkdirAll(cfg.Data.Path, 0755); err != nil {
logger.WithError(err).Error("error creating data directory")
return fmt.Errorf("creating data directory: %w", err)
}
router := apirouter.Handler()
router, err = registerWebUI(router)