From 70d5fd7698d66788a5932af53d9d8730b8641595 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 13 Sep 2024 14:48:01 -0400 Subject: [PATCH] target handling (#463) --- cmd/zrok/agentSharePublic.go | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index b770630e..2d91774c 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -73,14 +73,37 @@ func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { target = v case "web": - var err error - target, err = filepath.Abs(args[0]) + v, err := filepath.Abs(args[0]) if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } panic(err) } + target = v + + case "caddy": + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + + case "drive": + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v default: - target = args[0] + tui.Error(fmt.Sprintf("invalid backend mode '%v'", cmd.backendMode), nil) } root, err := environment.LoadRoot()