precreate folders to json files

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2021-03-04 15:26:03 +00:00
parent 2a565b80fa
commit 9669ae3ade
4 changed files with 38 additions and 0 deletions
+9
View File
@@ -6,6 +6,7 @@ import (
"os"
"os/signal"
"path"
"path/filepath"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
@@ -64,8 +65,16 @@ func Groups(cfg *config.Config) *cli.Command {
ctx, cancel = context.WithCancel(context.Background())
//metrics = metrics.New()
)
defer cancel()
// precreate folders
if cfg.Reva.Groups.Driver == "json" && cfg.Reva.Groups.JSON != "" {
if err := os.MkdirAll(filepath.Dir(cfg.Reva.Groups.JSON), os.ModeExclusive); err != nil {
return err
}
}
{
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")