예제 #1
0
파일: factory.go 프로젝트: xtracdev/xavi
func readListenerConfig(name string, kvs kvstore.KVStore) (lc *config.ListenerConfig, err error) {
	lc, err = config.ReadListenerConfig(name, kvs)

	if lc == nil {
		err = errors.New("Listener config '" + name + "' not found")
	}
	return
}
예제 #2
0
//GetDefinition retrieves a specific listener definition
func (ListenerDef) GetDefinition(kvs kvstore.KVStore, resp http.ResponseWriter, req *http.Request) (interface{}, error) {
	listenerName := resourceIDFromURI(req.RequestURI)

	listenerConfig, err := config.ReadListenerConfig(listenerName, kvs)
	if err != nil {
		resp.WriteHeader(http.StatusInternalServerError)
		return nil, err
	}

	if listenerConfig == nil {
		resp.WriteHeader(http.StatusNotFound)
		return nil, errListenerNotFound
	}

	return listenerConfig, err

}