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

keyfetch: make git dir configurable

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