Exemplo n.º 1
0
func ServiceList(rw http.ResponseWriter, r *http.Request) {
	log := servicesLogger("list").Start()

	services, err := models.ListServiceStacks()

	if err != nil {
		helpers.Error(log, err)
		RenderError(rw, err)
		return
	}

	RenderJson(rw, services)
}
Exemplo n.º 2
0
func ServiceNameList(rw http.ResponseWriter, r *http.Request) {
	log := servicesLogger("nameList").Start()

	t := mux.Vars(r)["type"]

	services, err := models.ListServiceStacks()

	if err != nil {
		helpers.Error(log, err)
		RenderError(rw, err)
		return
	}

	s := models.Services{}

	for _, item := range services {
		if item.Tags["Service"] == t {
			s = append(s, item)
		}
	}

	RenderPartial(rw, "services", "names", s)
}