Skip to content

Commit e2a9234

Browse files
committed
Add more meta data about server for easy identification
1 parent ba602ee commit e2a9234

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

cmd/version.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@ var versionCmd = &cobra.Command{
2626
defaultServerName, err := config.DefaultServer()
2727
if err == nil {
2828
server, _ := config.GetServer(defaultServerName)
29+
platform := "Linux"
30+
if server.Info.IsWindows {
31+
platform = "Windows"
32+
}
33+
2934
fmt.Println()
3035
fmt.Println("Server information")
3136
fmt.Printf("Host: \t%s\n", server.Host)
37+
fmt.Printf("Platform:\t%s\n", platform)
3238
fmt.Printf("Version:\t%s\n", server.Info.Version)
39+
fmt.Printf("Revision:\t%s\n", server.Info.Revision)
40+
fmt.Printf("Build date:\t%s\n", server.Info.BuildDate)
3341
}
3442

3543
return nil

internal/actions/servers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ func ServerUpdate(host types.Server) error {
163163
host.Info.IP = *ipAddr
164164
host.Info.IsWindows = info.IsWindows
165165
host.Info.Version = info.Version
166+
host.Info.Revision = info.Revision
167+
host.Info.BuildDate = info.BuildDate
166168
host.DatabaseServers = *dbs
167169
host.UpdatedAt = time.Now()
168170

internal/api/json/info.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ func (j jsonInfo) GetInfo() (api.ServerInfo, error) {
4949
}
5050

5151
if res.IsSuccess() {
52-
var r *serverInfo = res.Result().(*serverInfo)
52+
r := res.Result().(*serverInfo)
5353
return api.ServerInfo{
5454
IsWindows: r.Platform == "Windows",
5555
Version: r.PanelVersion + "." + r.PanelUpdateVersion,
56+
Revision: r.PanelRevision,
57+
BuildDate: r.PanelBuildDate,
5658
}, nil
5759
}
5860

internal/api/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ type Server interface {
8989
type ServerInfo struct {
9090
IsWindows bool
9191
Version string
92+
Revision string
93+
BuildDate string
9294
}
9395

9496
type AuthClient interface {

internal/types/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ func (s Server) GetDatabaseServerByType(dbt string) *DatabaseServer {
4949
type ServerInfo struct {
5050
IsWindows bool `json:"is_windows"`
5151
Version string `json:"version"`
52+
Revision string `json:"revision"`
53+
BuildDate string `json:"build_date"`
5254
IP ServerIPAddresses `json:"addresses"`
5355
}
5456

0 commit comments

Comments
 (0)