Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #457 from surajnarwade/fix_extends_support
Browse files Browse the repository at this point in the history
Added extends support when given as string
  • Loading branch information
vdemeester authored Apr 20, 2017
2 parents 0c65a10 + 748d6a3 commit c6a7d46
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/docker/libcompose/utils"
composeYaml "github.com/docker/libcompose/yaml"
"gopkg.in/yaml.v2"
"reflect"
)

var (
Expand Down Expand Up @@ -60,6 +61,18 @@ func Merge(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup
}
baseRawServices := config.Services

for service, data := range baseRawServices {
for key, value := range data {
//check for "extends" key and check whether it is string or not
if key == "extends" && reflect.TypeOf(value).Kind() == reflect.String {
//converting string to map
extendMap := make(map[interface{}]interface{})
extendMap["service"] = value
baseRawServices[service][key] = extendMap
}
}
}

if options.Interpolate {
if err := InterpolateRawServiceMap(&baseRawServices, environmentLookup); err != nil {
return "", nil, nil, nil, err
Expand Down

0 comments on commit c6a7d46

Please sign in to comment.