Exemple #1
0
func getBackendConf(hostname string) (bkconf.BackendConf, bool) {
	bc, err := bkconf.Get(hostname)
	if err == nil {
		return bc, true
	}
	return bc, false
}
Exemple #2
0
func (self *BackendConfResource) Get(ctx *rfweb.Context) {
	res := RespData{}
	hostname := ctx.Get("hostname")
	if hostname == "all" {
		bcs, err := bkconf.GetAll()
		if err != nil {
			res.Error = err.Error()
		} else {
			res.Success = true
			res.Data = bcs
		}
	} else {
		bc, err := bkconf.Get(hostname)
		if err != nil {
			res.Error = err.Error()
		} else {
			res.Success = true
			res.Data = bc
		}
	}

	util.WriteJson(ctx.W, res)
}