mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 07:09:12 +01: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 {
|
||||
service bool
|
||||
basicAuth []string
|
||||
cmd *cobra.Command
|
||||
}
|
||||
@ -39,17 +40,20 @@ func newHttpCommand() *httpCommand {
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
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.Run = command.run
|
||||
return command
|
||||
}
|
||||
|
||||
func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
||||
if !self.service {
|
||||
if err := ui.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer ui.Close()
|
||||
tb.SetInputMode(tb.InputEsc)
|
||||
}
|
||||
|
||||
idCfg, err := zrokdir.IdentityConfigFile()
|
||||
if err != nil {
|
||||
@ -113,6 +117,7 @@ func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
||||
}
|
||||
}()
|
||||
|
||||
if !self.service {
|
||||
ui.Clear()
|
||||
w, h := ui.TerminalDimensions()
|
||||
|
||||
@ -172,6 +177,12 @@ func (self *httpCommand) run(_ *cobra.Command, args []string) {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user