open-nomad/nomad/server_setup.go
Daniel Bennett 39e3a1ac3e
build/cli: Add BuildDate (#16216)
* build: add BuildDate to version info

will be used in enterprise to compare to license expiration time

* cli: multi-line version output, add BuildDate

before:
$ nomad version
Nomad v1.4.3 (coolfakecommithashomgoshsuchacoolonewoww)

after:
$ nomad version
Nomad v1.5.0-dev
BuildDate 2023-02-17T19:29:26Z
Revision coolfakecommithashomgoshsuchacoolonewoww

compare consul:
$ consul version
Consul v1.14.4
Revision dae670fe
Build Date 2023-01-26T15:47:10Z
Protocol 2 spoken by default, blah blah blah...

and vault:
$ vault version
Vault v1.12.3 (209b3dd99fe8ca320340d08c70cff5f620261f9b), built 2023-02-02T09:07:27Z

* docs: update version command output
2023-02-27 11:27:40 -06:00

37 lines
763 B
Go

package nomad
import (
"time"
"github.com/hashicorp/go-hclog"
"golang.org/x/exp/slices"
)
// LicenseConfig allows for tunable licensing config
// primarily used for enterprise testing
type LicenseConfig struct {
// BuildDate is the time of the git commit used to build the program.
BuildDate time.Time
// LicenseEnvBytes is the license bytes to use for the server's license
LicenseEnvBytes string
// LicensePath is the path to use for the server's license
LicensePath string
// AdditionalPubKeys is a set of public keys to
AdditionalPubKeys []string
Logger hclog.InterceptLogger
}
func (c *LicenseConfig) Copy() *LicenseConfig {
if c == nil {
return nil
}
nc := *c
nc.AdditionalPubKeys = slices.Clone(c.AdditionalPubKeys)
return &nc
}