diff --git a/agent/publicShare.go b/agent/publicShare.go index 4337eb90..e35c6ec9 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -6,6 +6,7 @@ import ( "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/sdk/golang/sdk" "github.com/sirupsen/logrus" "os" ) @@ -20,8 +21,12 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar return nil, errors.New("unable to load environment; did you 'zrok enable'?") } - shr := &share{ready: make(chan struct{})} shrCmd := []string{os.Args[0], "share", "public", "--agent", "-b", req.BackendMode} + shr := &share{ + shareMode: sdk.PublicShareMode, + backendMode: sdk.BackendMode(req.BackendMode), + ready: make(chan struct{}), + } for _, basicAuth := range req.BasicAuth { shrCmd = append(shrCmd, "--basic-auth", basicAuth) diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index 352d4c43..b770630e 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -8,6 +8,7 @@ import ( "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" + "path/filepath" "time" ) @@ -70,6 +71,16 @@ func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { panic(err) } target = v + + case "web": + var err error + target, err = filepath.Abs(args[0]) + if err != nil { + panic(err) + } + + default: + target = args[0] } root, err := environment.LoadRoot()