Skip to content

Commit

Permalink
Tweak server start-up text (#624)
Browse files Browse the repository at this point in the history
Another iteration of tweaking the start-up message:

**Was**:

```
$ temporal server start-dev
Temporal server: localhost:7233
Web UI:          http://localhost:8233/
Metrics:         http://localhost:53881/metrics
```

**Becomes**:


```
$ temporal server start-dev
CLI 0.0.0-DEV (Server 1.24.1, UI 2.28.0)

Server:  localhost:7233
UI:      http://localhost:8233
Metrics: http://localhost:58550/metrics
```
  • Loading branch information
dandavison committed Jul 15, 2024
1 parent fad6810 commit 358f265
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion temporalcli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func Execute(ctx context.Context, options CommandOptions) {
}

func (c *TemporalCommand) initCommand(cctx *CommandContext) {
c.Command.Version = fmt.Sprintf("%s (server %s) (ui %s)", Version, headers.ServerVersion, version.UIVersion)
c.Command.Version = VersionString()
// Unfortunately color is a global option, so we can set in pre-run but we
// must unset in post-run
origNoColor := color.NoColor
Expand Down Expand Up @@ -394,6 +394,10 @@ func (c *TemporalCommand) initCommand(cctx *CommandContext) {
}
}

func VersionString() string {
return fmt.Sprintf("%s (Server %s, UI %s)", Version, headers.ServerVersion, version.UIVersion)
}

func (c *TemporalCommand) preRun(cctx *CommandContext) error {
// Configure logger if not already on context
if cctx.Logger == nil {
Expand Down
7 changes: 4 additions & 3 deletions temporalcli/commands.server.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string)
return err
}

cctx.Printer.Printlnf("%-16s %v:%v", "Temporal server:", toFriendlyIp(opts.FrontendIP), opts.FrontendPort)
cctx.Printer.Printlnf("CLI %v\n", VersionString())
cctx.Printer.Printlnf("%-8s %v:%v", "Server:", toFriendlyIp(opts.FrontendIP), opts.FrontendPort)
if !t.Headless {
cctx.Printer.Printlnf("%-16s http://%v:%v", "Web UI:", toFriendlyIp(opts.UIIP), opts.UIPort)
cctx.Printer.Printlnf("%-8s http://%v:%v", "UI:", toFriendlyIp(opts.UIIP), opts.UIPort)
}
cctx.Printer.Printlnf("%-16s http://%v:%v/metrics", "Metrics:", toFriendlyIp(opts.FrontendIP), opts.MetricsPort)
cctx.Printer.Printlnf("%-8s http://%v:%v/metrics", "Metrics:", toFriendlyIp(opts.FrontendIP), opts.MetricsPort)
<-cctx.Done()
cctx.Printer.Println("Stopping server...")
return nil
Expand Down

0 comments on commit 358f265

Please sign in to comment.