More documentation

This commit is contained in:
2021-11-30 15:45:36 +01:00
parent e18a797504
commit b586b1eac8
5 changed files with 31 additions and 16 deletions

View File

@@ -7,12 +7,14 @@ import (
"gopkg.in/yaml.v3"
)
// Parser is a docker-compose parser.
type Parser struct {
Data *Compose
}
var Appname = ""
// NewParser create a Parser and parse the file given in filename.
func NewParser(filename string) *Parser {
f, err := os.Open(filename)

View File

@@ -1,5 +1,21 @@
package compose
// Compose is a complete docker-compse representation.
type Compose struct {
Version string `yaml:"version"`
Services map[string]Service `yaml:"services"`
Volumes map[string]interface{} `yaml:"volumes"`
}
// NewCompose resturs a Compose object.
func NewCompose() *Compose {
c := &Compose{}
c.Services = make(map[string]Service)
c.Volumes = make(map[string]interface{})
return c
}
// Service represent a "service" in a docker-compose file.
type Service struct {
Image string `yaml:"image"`
Ports []string `yaml:"ports"`
@@ -9,16 +25,3 @@ type Service struct {
Volumes []string `yaml:"volumes"`
Expose []int `yaml:"expose"`
}
type Compose struct {
Version string `yaml:"version"`
Services map[string]Service `yaml:"services"`
Volumes map[string]interface{} `yaml:"volumes"`
}
func NewCompose() *Compose {
c := &Compose{}
c.Services = make(map[string]Service)
c.Volumes = make(map[string]interface{})
return c
}