Skip to content

Commit

Permalink
Moved platform string to cmd level, passed through as BuildInfo to be…
Browse files Browse the repository at this point in the history
… more compatible with enterprise code
  • Loading branch information
Adam committed Feb 27, 2018
1 parent c6affef commit 396825e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions cmd/kapacitord/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (m *Main) Run(args ...string) error {
cmd.Version = version
cmd.Commit = commit
cmd.Branch = branch
cmd.Platform = "OSS"

err := cmd.Run(args...)
// Use diagnostic from cmd since it may have special config now.
Expand Down
9 changes: 5 additions & 4 deletions cmd/kapacitord/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ type Diagnostic interface {

// Command represents the command executed by "kapacitord run".
type Command struct {
Version string
Branch string
Commit string
Version string
Branch string
Commit string
Platform string

closing chan struct{}
pidfile string
Expand Down Expand Up @@ -122,7 +123,7 @@ func (cmd *Command) Run(args ...string) error {
cmd.pidfile = options.PIDFile

// Create server from config and start it.
buildInfo := server.BuildInfo{Version: cmd.Version, Commit: cmd.Commit, Branch: cmd.Branch}
buildInfo := server.BuildInfo{Version: cmd.Version, Commit: cmd.Commit, Branch: cmd.Branch, Platform: cmd.Platform}
s, err := server.New(config, buildInfo, cmd.diagService)
if err != nil {
return fmt.Errorf("create server: %s", err)
Expand Down
9 changes: 5 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ const serverIDFilename = "server.id"

// BuildInfo represents the build details for the server code.
type BuildInfo struct {
Version string
Commit string
Branch string
Version string
Commit string
Branch string
Platform string
}

type Diagnostic interface {
Expand Down Expand Up @@ -184,7 +185,7 @@ func New(c *Config, buildInfo BuildInfo, diagService *diagnostic.Service) (*Serv
vars.ServerIDVar.Set(s.ServerID)
vars.HostVar.Set(s.hostname)
vars.ProductVar.Set(vars.Product)
vars.PlatformVar.Set(vars.Platform)
vars.PlatformVar.Set(s.BuildInfo.Platform)
vars.VersionVar.Set(s.BuildInfo.Version)
s.Diag.Info("listing ClusterID and ServerID",
keyvalue.KV("cluster_id", s.ClusterID.String()), keyvalue.KV("server_id", s.ServerID.String()))
Expand Down
3 changes: 1 addition & 2 deletions server/vars/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const (
UptimeVarName = "uptime"

// The name of the product
Product = "kapacitor"
Platform = "OSS"
Product = "kapacitor"
)

var (
Expand Down

0 comments on commit 396825e

Please sign in to comment.