forked from tangled.org/core
this repo has no description

keyfetch: flag for log path

Changed files
+5 -4
cmd
keyfetch
+3 -3
cmd/keyfetch/format.go
···
"fmt"
)
-
func formatKeyData(repoguardPath string, gitDir string, data []map[string]interface{}) string {
+
func formatKeyData(repoguardPath, gitDir, logPath string, data []map[string]interface{}) string {
var result string
for _, entry := range data {
result += fmt.Sprintf(
-
`command="%s -base-dir %s -user %s -log-path /home/git/log ",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s`+"\n",
-
repoguardPath, gitDir, entry["did"], entry["key"])
+
`command="%s -base-dir %s -user %s -log-path %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s`+"\n",
+
repoguardPath, gitDir, entry["did"], logPath, entry["key"])
}
return result
}
+2 -1
cmd/keyfetch/main.go
···
endpoint := flag.String("internal-api", "http://localhost:5444", "Internal API endpoint")
repoguardPath := flag.String("repoguard-path", "/home/git/repoguard", "Path to the repoguard binary")
gitDir := flag.String("git-dir", "/home/git", "Path to the git directory")
+
logPath := flag.String("log-path", "/home/git/log", "Path to log file")
flag.Parse()
resp, err := http.Get(*endpoint + "/keys")
···
log.Fatalf("error unmarshalling response body: %v", err)
}
-
fmt.Print(formatKeyData(*repoguardPath, *gitDir, data))
+
fmt.Print(formatKeyData(*repoguardPath, *gitDir, *logPath, data))
}