added listen flag
This commit is contained in:
3
main.go
3
main.go
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user