added listen flag

This commit is contained in:
2026-06-07 21:17:14 +02:00
parent 53b6f72cfa
commit 1757d1d8e5

View File

@@ -101,6 +101,7 @@ func validateUnlockCommand(command string) bool {
func main() { func main() {
unlockCommandFlag := flag.String("command", "", "what script to execute to unlock the volume") unlockCommandFlag := flag.String("command", "", "what script to execute to unlock the volume")
listenOn := flag.String("listen", ":50059", "specify port to listen on")
flag.Parse() flag.Parse()
if *unlockCommandFlag == "" { if *unlockCommandFlag == "" {
@@ -125,7 +126,7 @@ func main() {
mux.Handle("/api/unlock", apiKeyMiddleware(apiKey, http.HandlerFunc(unlockZFSHandler))) mux.Handle("/api/unlock", apiKeyMiddleware(apiKey, http.HandlerFunc(unlockZFSHandler)))
srv := &http.Server{ srv := &http.Server{
Addr: ":8080", Addr: *listenOn,
Handler: mux, Handler: mux,
ReadTimeout: 5 * time.Second, ReadTimeout: 5 * time.Second,
WriteTimeout: 31 * time.Second, WriteTimeout: 31 * time.Second,