server_metadata.go
TLDR
This file defines the ServerMetadata
struct and implements a method GetServerMetadata()
that returns an instance of ServerMetadata
.
Classes
ServerMetadata
The ServerMetadata
class defines a struct with the following fields:
-
Version
(string): The version of the server. -
BuildNumber
(string): The build number of the server. -
BuildDate
(string): The build date of the server. -
Commit
(string): The commit hash of the server. -
Edition
(string): The edition of the server. -
DBType
(string): The type of the database used by the server. -
DBVersion
(string): The version of the database used by the server. -
OSType
(string): The operating system type of the server. -
OSArch
(string): The operating system architecture of the server. -
SKU
(string): The stock keeping unit (SKU) of the server.
Methods
GetServerMetadata()
This method returns an instance of the ServerMetadata
struct. It populates the fields of the struct with the current server metadata, such as the version, build number, build date, commit hash, edition, database type, database version, operating system type, operating system architecture, and SKU.
package app
import (
"runtime"
"github.com/mattermost/focalboard/server/model"
)
type ServerMetadata struct {
Version string `json:"version"`
BuildNumber string `json:"build_number"`
BuildDate string `json:"build_date"`
Commit string `json:"commit"`
Edition string `json:"edition"`
DBType string `json:"db_type"`
DBVersion string `json:"db_version"`
OSType string `json:"os_type"`
OSArch string `json:"os_arch"`
SKU string `json:"sku"`
}
func (a *App) GetServerMetadata() *ServerMetadata {
var dbType string
var dbVersion string
if a != nil && a.store != nil {
dbType = a.store.DBType()
dbVersion = a.store.DBVersion()
}
return &ServerMetadata{
Version: model.CurrentVersion,
BuildNumber: model.BuildNumber,
BuildDate: model.BuildDate,
Commit: model.BuildHash,
Edition: model.Edition,
DBType: dbType,
DBVersion: dbVersion,
OSType: runtime.GOOS,
OSArch: runtime.GOARCH,
SKU: "personal_server",
}
}