Worker: fix "failed to retrieve Orchard's home directory path" (#309)

When running through launchd and no HOME is set.
This commit is contained in:
Nikolay Edigaryev
2025-04-17 21:57:04 +04:00
committed by GitHub
parent 0a3d9c6d1c
commit 40f222c408
3 changed files with 13 additions and 23 deletions
+2 -10
View File
@@ -1,10 +1,7 @@
package controller
import (
"github.com/cirruslabs/orchard/internal/orchardhome"
"github.com/spf13/cobra"
"log"
"path/filepath"
)
var dataDirPath string
@@ -17,13 +14,8 @@ func NewCommand() *cobra.Command {
command.AddCommand(newRunCommand())
orchardHome, err := orchardhome.Path()
if err != nil {
log.Fatal(err)
}
command.PersistentFlags().StringVar(&dataDirPath, "data-dir", filepath.Join(orchardHome, "controller"),
"path to the data controller's directory")
command.PersistentFlags().StringVar(&dataDirPath, "data-dir", "",
"path to the data controller's directory (defaults to $HOME/.orchard/controller)")
return command
}