Skip to content

Commit

Permalink
Create configured cache dir if DNE
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelattwood committed Jan 21, 2025
1 parent 4e441c2 commit 206f797
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/jetstream-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ func runControlLoop(config *rest.Config, natsCfg *controller.NatsConfig, control
}
defer os.RemoveAll(cacheDir)
controllerCfg.CacheDir = cacheDir
} else {
if _, err := os.Stat(controllerCfg.CacheDir); os.IsNotExist(err) {
err = os.MkdirAll(controllerCfg.CacheDir, 0o755)
if err != nil {
return fmt.Errorf("create cache dir: %w", err)
}
}
}

err = controller.RegisterAll(mgr, natsCfg, controllerCfg)
Expand Down

0 comments on commit 206f797

Please sign in to comment.