1
0
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:
Rachel Williams
2020-07-24 15:17:17 -07:00
committed by Areg Harutyunyan
parent 0708a49848
commit d8ebde37ca
173 changed files with 31376 additions and 188 deletions

View File

@@ -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,
}),
}
}