Skip to content

Commit

Permalink
feat: print version when startup
Browse files Browse the repository at this point in the history
  • Loading branch information
bitxeno committed Jul 2, 2024
1 parent 015e941 commit fa997e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package server
import (
"github.com/bitxeno/go-docker-skeleton/internal/app"
"github.com/bitxeno/go-docker-skeleton/web"
"github.com/fatih/color"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -72,9 +73,15 @@ func action(c *cli.Context) error {
return err
}

printVersion()
port := conf.Server.Port
if c.Int("port") > 0 {
port = c.Int("port")
}
return web.Run(conf.Server.ListenAddr, port)
}

func printVersion() {
color.New(color.FgGreen).Print("Starting server version: ")
color.New(color.FgCyan).Printf("%s@%s@%v\n", app.Version.Version, app.Version.BuildDate, app.Mode)
}

0 comments on commit fa997e1

Please sign in to comment.