forked from LaconicNetwork/kompose
@@ -152,7 +152,7 @@ func checkUnsupportedKey(composeProject *types.Project) []string {
|
||||
// LoadFile loads a compose file into KomposeObject
|
||||
func (c *Compose) LoadFile(files []string, profiles []string) (kobject.KomposeObject, error) {
|
||||
// Gather the working directory
|
||||
workingDir, err := getComposeFileDir(files)
|
||||
workingDir, err := transformer.GetComposeFileDir(files)
|
||||
if err != nil {
|
||||
return kobject.KomposeObject{}, err
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package compose
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -133,20 +132,6 @@ func loadEnvVars(envars []string) []kobject.EnvVar {
|
||||
return envs
|
||||
}
|
||||
|
||||
// getComposeFileDir returns compose file directory
|
||||
// Assume all the docker-compose files are in the same directory
|
||||
func getComposeFileDir(inputFiles []string) (string, error) {
|
||||
inputFile := inputFiles[0]
|
||||
if strings.Index(inputFile, "/") != 0 {
|
||||
workDir, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "Unable to retrieve compose file directory")
|
||||
}
|
||||
inputFile = filepath.Join(workDir, inputFile)
|
||||
}
|
||||
return filepath.Dir(inputFile), nil
|
||||
}
|
||||
|
||||
func handleServiceType(ServiceType string) (string, error) {
|
||||
switch strings.ToLower(ServiceType) {
|
||||
case "", "clusterip":
|
||||
|
||||
Reference in New Issue
Block a user