mirror of
https://github.com/openziti/zrok.git
synced 2025-06-23 03:01:54 +02:00
'zrok http -s' for 'service mode' (no tui chrome)
This commit is contained in:
parent
e32bca31b2
commit
2983d16a06
@ -28,6 +28,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type httpCommand struct {
|
type httpCommand struct {
|
||||||
|
service bool
|
||||||
basicAuth []string
|
basicAuth []string
|
||||||
cmd *cobra.Command
|
cmd *cobra.Command
|
||||||
}
|
}
|
||||||
@ -39,17 +40,20 @@ func newHttpCommand() *httpCommand {
|
|||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
}
|
}
|
||||||
command := &httpCommand{cmd: cmd}
|
command := &httpCommand{cmd: cmd}
|
||||||
|
cmd.Flags().BoolVarP(&command.service, "service", "s", false, "Disable TUI 'chrome' for service operation")
|
||||||
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.Run = command.run
|
cmd.Run = command.run
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
||||||
|
if !self.service {
|
||||||
if err := ui.Init(); err != nil {
|
if err := ui.Init(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer ui.Close()
|
defer ui.Close()
|
||||||
tb.SetInputMode(tb.InputEsc)
|
tb.SetInputMode(tb.InputEsc)
|
||||||
|
}
|
||||||
|
|
||||||
idCfg, err := zrokdir.IdentityConfigFile()
|
idCfg, err := zrokdir.IdentityConfigFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -113,6 +117,7 @@ func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if !self.service {
|
||||||
ui.Clear()
|
ui.Clear()
|
||||||
w, h := ui.TerminalDimensions()
|
w, h := ui.TerminalDimensions()
|
||||||
|
|
||||||
@ -172,6 +177,12 @@ func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
|||||||
ui.Render(p, slg)
|
ui.Render(p, slg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for {
|
||||||
|
logrus.Infof("access your zrok service: %v", resp.Payload.ProxyEndpoint)
|
||||||
|
time.Sleep(30 * time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanupHttp(id string, cfg *http.Config, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) {
|
func cleanupHttp(id string, cfg *http.Config, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user