Skip to content

Commit

Permalink
Fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kujtim committed Oct 10, 2017
1 parent 28af64a commit 555ce98
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions generator/generate_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,19 @@ func (g *GenerateDocker) addToDockerCompose(name, pth, httpFilePath, grpcFilePat
}
usedPorts := []string{}
for _, v := range g.dockerCompose.Services {
for _, p := range v.(map[interface{}]interface{})["ports"].([]interface{}) {
pt := strings.Split(p.(string), ":")
usedPorts = append(usedPorts, pt[0])
k, ok := v.(map[interface{}]interface{})
if ok {
for _, p := range k["ports"].([]interface{}) {
pt := strings.Split(p.(string), ":")
usedPorts = append(usedPorts, pt[0])
}
} else {
for _, p := range v.(*DockerService).Ports {
pt := strings.Split(p, ":")
usedPorts = append(usedPorts, pt[0])
}
}

}
if g.dockerCompose.Services[name] == nil {
g.dockerCompose.Services[name] = &DockerService{
Expand Down

0 comments on commit 555ce98

Please sign in to comment.