Example #1
0
func ComposeArch(name string, c ComposeYaml) {
	a := architecture.MakeArch(name, "compose yaml")
	for n, v := range c {
		//fmt.Println("Compose: ", n, v.Image, v.Build, v.Links)
		co := v.Image
		if co == "" {
			co = v.Build
		}
		var links []string // change db:redis into db
		for _, l := range v.Links {
			links = append(links, strings.Split(l, ":")[0])
		}
		architecture.AddContainer(a, n, "machine", "instance", co, "process", "monolith", 1, 3, links)
	}
	architecture.Write(a)
}
Example #2
0
func try(t string) {
	var c ComposeYaml
	err := yaml.Unmarshal([]byte(t), &c)
	if err != nil {
		fmt.Println(err)
	}
	a := architecture.MakeArch("test", "compose yaml")
	for n, v := range c {
		fmt.Println("Compose: ", n, v.Image, v.Build, v.Links)
		c := v.Image
		if c == "" {
			c = v.Build
		}
		var links []string // change db:redis into db
		for _, l := range v.Links {
			links = append(links, strings.Split(l, ":")[0])
		}
		architecture.AddContainer(a, n, "machine", "instance", c, "process", "monolith", 1, 3, links)
	}
	fmt.Println(*a)
}