Skip to content

Commit

Permalink
Adding the changes to structs
Browse files Browse the repository at this point in the history
  • Loading branch information
diptanu committed Dec 11, 2015
1 parent 519dc4c commit 57ff1a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 57ff1a3

Please sign in to comment.