示例#1
0
func parsing(request *cocaine.Request, response *cocaine.Response) {
	defer response.Close()
	raw := <-request.Read()
	name := string(raw)
	if data, err := configmanager.GetParsingCfg(name); err != nil {
		response.ErrorMsg(-2, fmt.Sprintf("Missing file with name %s", name))
	} else {
		response.Write(data)
	}
}
示例#2
0
func TestParsing(t *testing.T) {
	var m ParsingConfig
	data, err := configmanager.GetParsingCfg("photo_proxy.json")
	if err != nil {
		t.Fatal(err)
	}
	err = goyaml.Unmarshal(data, &m)
	if err != nil {
		t.Fatal(err)
	}
	t.Log(m.Groups, m.AggConfigs, m.Parser)
}