Go to Katenary V3

This is the next-gen of Katenary
This commit is contained in:
2023-12-06 15:24:02 +01:00
parent c37bde487b
commit 475a025d9e
132 changed files with 6410 additions and 4621 deletions

29
parser/main.go Normal file
View File

@@ -0,0 +1,29 @@
// Parser package is a wrapper around compose-go to parse compose files.
package parser
import (
"github.com/compose-spec/compose-go/cli"
"github.com/compose-spec/compose-go/types"
)
// Parse compose files and return a project. The project is parsed with dotenv, osenv and profiles.
func Parse(profiles []string, dockerComposeFile ...string) (*types.Project, error) {
if len(dockerComposeFile) > 0 {
cli.DefaultFileNames = dockerComposeFile
}
options, err := cli.NewProjectOptions(nil,
cli.WithProfiles(profiles),
cli.WithDefaultConfigPath,
cli.WithOsEnv,
cli.WithDotEnv,
cli.WithNormalization(true),
cli.WithInterpolation(true),
//cli.WithResolvedPaths(true),
)
if err != nil {
return nil, err
}
return cli.ProjectFromOptions(options)
}