forked from LaconicNetwork/kompose
added support for multiple-compose files
This commit is contained in:
@@ -173,12 +173,12 @@ func loadPorts(service Service) ([]kobject.Ports, string) {
|
||||
}
|
||||
|
||||
// load dab file into KomposeObject
|
||||
func (b *Bundle) LoadFile(file string) kobject.KomposeObject {
|
||||
func (b *Bundle) LoadFile(files []string) kobject.KomposeObject {
|
||||
komposeObject := kobject.KomposeObject{
|
||||
ServiceConfigs: make(map[string]kobject.ServiceConfig),
|
||||
LoadedFrom: "bundle",
|
||||
}
|
||||
|
||||
file := files[0]
|
||||
buf, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
logrus.Fatalf("Failed to read bundles file: %s ", err)
|
||||
|
||||
@@ -221,16 +221,16 @@ func loadPorts(composePorts []string) ([]kobject.Ports, error) {
|
||||
}
|
||||
|
||||
// load compose file into KomposeObject
|
||||
func (c *Compose) LoadFile(file string) kobject.KomposeObject {
|
||||
func (c *Compose) LoadFile(files []string) kobject.KomposeObject {
|
||||
komposeObject := kobject.KomposeObject{
|
||||
ServiceConfigs: make(map[string]kobject.ServiceConfig),
|
||||
LoadedFrom: "compose",
|
||||
}
|
||||
context := &project.Context{}
|
||||
if file == "" {
|
||||
file = "docker-compose.yml"
|
||||
if len(files) == 0 {
|
||||
files = append(files, "docker-compose.yml")
|
||||
}
|
||||
context.ComposeFiles = []string{file}
|
||||
context.ComposeFiles = files
|
||||
|
||||
if context.ResourceLookup == nil {
|
||||
context.ResourceLookup = &lookup.FileResourceLookup{}
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
type Loader interface {
|
||||
LoadFile(file string) kobject.KomposeObject
|
||||
LoadFile(files []string) kobject.KomposeObject
|
||||
///Name() string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user