github.com/wgh-/mattermost-server@v4.8.0-rc2+incompatible/cmd/platform/version.go (about)

     1  // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  package main
     4  
     5  import (
     6  	"github.com/mattermost/mattermost-server/app"
     7  	"github.com/mattermost/mattermost-server/model"
     8  	"github.com/mattermost/mattermost-server/store"
     9  	"github.com/mattermost/mattermost-server/store/sqlstore"
    10  	"github.com/spf13/cobra"
    11  )
    12  
    13  var versionCmd = &cobra.Command{
    14  	Use:   "version",
    15  	Short: "Display version information",
    16  	RunE:  versionCmdF,
    17  }
    18  
    19  func versionCmdF(cmd *cobra.Command, args []string) error {
    20  	a, err := initDBCommandContextCobra(cmd)
    21  	if err != nil {
    22  		return err
    23  	}
    24  
    25  	printVersion(a)
    26  
    27  	return nil
    28  }
    29  
    30  func printVersion(a *app.App) {
    31  	CommandPrintln("Version: " + model.CurrentVersion)
    32  	CommandPrintln("Build Number: " + model.BuildNumber)
    33  	CommandPrintln("Build Date: " + model.BuildDate)
    34  	CommandPrintln("Build Hash: " + model.BuildHash)
    35  	CommandPrintln("Build Enterprise Ready: " + model.BuildEnterpriseReady)
    36  	if supplier, ok := a.Srv.Store.(*store.LayeredStore).DatabaseLayer.(*sqlstore.SqlSupplier); ok {
    37  		CommandPrintln("DB Version: " + supplier.GetCurrentSchemaVersion())
    38  	}
    39  }