fix: Set server version (#150)

This commit is contained in:
Wenxin Du
2024-12-18 17:15:55 -05:00
committed by GitHub
parent 46f8bb3bc4
commit abd1eb702c
2 changed files with 5 additions and 0 deletions

View File

@@ -89,6 +89,9 @@ func NewCommand(opts ...Option) *Command {
o(cmd)
}
// Set server version
cmd.cfg.Version = versionString
// set baseCmd out and err the same as cmd.
baseCmd.SetOut(cmd.outStream)
baseCmd.SetErr(cmd.errStream)

View File

@@ -33,6 +33,8 @@ import (
)
func withDefaults(c server.ServerConfig) server.ServerConfig {
data, _ := os.ReadFile("version.txt")
c.Version = strings.TrimSpace(string(data))
if c.Address == "" {
c.Address = "127.0.0.1"
}