mirror of
https://github.com/openziti/zrok.git
synced 2025-02-18 03:01:02 +01:00
zrok reserve needs to support '--frontends' for public reservations
This commit is contained in:
parent
85311402d9
commit
d1a0afd6a0
@ -19,8 +19,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type reserveCommand struct {
|
type reserveCommand struct {
|
||||||
basicAuth []string
|
basicAuth []string
|
||||||
cmd *cobra.Command
|
frontendSelection []string
|
||||||
|
cmd *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
func newReserveCommand() *reserveCommand {
|
func newReserveCommand() *reserveCommand {
|
||||||
@ -31,6 +32,7 @@ func newReserveCommand() *reserveCommand {
|
|||||||
}
|
}
|
||||||
command := &reserveCommand{cmd: cmd}
|
command := &reserveCommand{cmd: cmd}
|
||||||
cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (<username:password>,...)")
|
cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (<username:password>,...)")
|
||||||
|
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontends", []string{"public"}, "Selected frontends to use for the share")
|
||||||
cmd.Run = command.run
|
cmd.Run = command.run
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
@ -79,6 +81,9 @@ func (cmd *reserveCommand) run(_ *cobra.Command, args []string) {
|
|||||||
AuthScheme: string(model.None),
|
AuthScheme: string(model.None),
|
||||||
Reserved: true,
|
Reserved: true,
|
||||||
}
|
}
|
||||||
|
if shareMode == "public" {
|
||||||
|
req.Body.FrontendSelection = cmd.frontendSelection
|
||||||
|
}
|
||||||
if len(cmd.basicAuth) > 0 {
|
if len(cmd.basicAuth) > 0 {
|
||||||
logrus.Infof("configuring basic auth")
|
logrus.Infof("configuring basic auth")
|
||||||
req.Body.AuthScheme = string(model.Basic)
|
req.Body.AuthScheme = string(model.Basic)
|
||||||
@ -94,7 +99,6 @@ func (cmd *reserveCommand) run(_ *cobra.Command, args []string) {
|
|||||||
|
|
||||||
resp, err := zrok.Service.Share(req, auth)
|
resp, err := zrok.Service.Share(req, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Close()
|
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
showError("unable to create tunnel", err)
|
showError("unable to create tunnel", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user