mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-09 04:30:31 +08:00
TUN-3201: Create base cloudflared UI structure
This commit is contained in:
committed by
Areg Harutyunyan
parent
0708a49848
commit
d8ebde37ca
@@ -288,6 +288,11 @@ func createLogger(c *cli.Context, isTransport bool) (logger.Service, error) {
|
||||
}
|
||||
loggerOpts = append(loggerOpts, logger.LogLevelString(logLevel))
|
||||
|
||||
if c.IsSet("launch-ui") {
|
||||
disableOption := logger.DisableTerminal(true)
|
||||
loggerOpts = append(loggerOpts, disableOption)
|
||||
}
|
||||
|
||||
return logger.New(loggerOpts...)
|
||||
}
|
||||
|
||||
@@ -526,6 +531,11 @@ func StartServer(c *cli.Context, version string, shutdownC, graceShutdownC chan
|
||||
errC <- origin.StartTunnelDaemon(ctx, tunnelConfig, connectedSignal, cloudflaredID, reconnectCh)
|
||||
}()
|
||||
|
||||
if c.IsSet("launch-ui") {
|
||||
tunnelInfo := newUIModel(version, hostname, metricsListener.Addr().String(), tunnelConfig.OriginUrl)
|
||||
tunnelInfo.launchUI(ctx, logger)
|
||||
}
|
||||
|
||||
return waitToShutdown(&wg, errC, shutdownC, graceShutdownC, c.Duration("grace-period"), logger)
|
||||
}
|
||||
|
||||
@@ -1122,6 +1132,12 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
|
||||
Usage: "Stable name to identify the tunnel. Using this flag will create, route and run a tunnel. For production usage, execute each command separately",
|
||||
Hidden: true,
|
||||
}),
|
||||
altsrc.NewBoolFlag(&cli.BoolFlag{
|
||||
Name: "launch-ui",
|
||||
Usage: "Launch tunnel UI and disable logs",
|
||||
Value: false,
|
||||
Hidden: shouldHide,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user