Adding the changes to structs

This commit is contained in:
Diptanu Choudhury
2015-12-11 14:03:52 -08:00
parent 519dc4c65b
commit 57ff1a3009

View File

@@ -1145,6 +1145,10 @@ func (sc *ServiceCheck) Hash(serviceId string) string {
return fmt.Sprintf("%x", h.Sum(nil))
}
const (
NomadConsulPrefix = "nomad"
)
// The Service model represents a Consul service defintion
type Service struct {
Id string // Id of the service, this needs to be unique on a local machine
@@ -1157,7 +1161,7 @@ type Service struct {
// InitFields interpolates values of Job, Task Group and Task in the Service
// Name. This also generates check names, service id and check ids.
func (s *Service) InitFields(job string, taskGroup string, task string) {
s.Id = fmt.Sprintf("nomad-%s", GenerateUUID())
s.Id = fmt.Sprintf("%s-%s", NomadConsulPrefix, GenerateUUID())
s.Name = args.ReplaceEnv(s.Name, map[string]string{
"JOB": job,
"TASKGROUP": taskGroup,