func (c *cachedLoader) Import(data []byte) error {
	conf := make(map[string]interface{})
	err := json.Unmarshal(data, &conf)
	if err != nil {
		return fmt.Errorf("Unable to parse json data: %v", err)
	}
	kvMap, err := c.compileKeyValues(conf, c.namespace)
	if err != nil {
		return fmt.Errorf("Unable to complie KVs: %v", err)
	}

	if err != nil {
		return fmt.Errorf("Could not create consul client: %v", err)
	}
	for k, v := range kvMap {
		p := &api.KVPair{Key: k, Value: v}
		_, err = c.consulKV.Put(p, nil)
		if err != nil {
			return fmt.Errorf("Could not write key to consul (%s | %s) %v", k, v, err)
		}
	}
	return nil
}
func (c *cachedLoader) Import(data []byte) error {
	conf := make(map[string]interface{})
	err := json.Unmarshal(data, &conf)
	if err != nil {
		return fmt.Errorf("Unable to parse json data: %v", err)
	}
	kvMap, err := c.compileKeyValues(conf, c.namespace)
	if err != nil {
		return fmt.Errorf("Unable to complie KVs: %v", err)
	}

	if err != nil {
		return fmt.Errorf("Could not create consul client: %v", err)
	}
	for k, v := range kvMap {
		p := &api.KVPair{Key: k, Value: v}
		_, err = c.consulKV.Put(p, nil)
		if err != nil {
			return fmt.Errorf("Could not write key to consul (%s | %s) %v", k, v, err)
		}
	}
	return nil
}
func ( c * cachedLoader ) Import ( data [ ] byte ) error { conf := make ( map [ string ] interface { } ) err := json . Unmarshal ( data , & conf ) if err != nil { return fmt . Errorf ( " " , err ) } kvMap , err := c . compileKeyValues ( conf , c . namespace ) if err != nil { return fmt . Errorf ( " " , err ) } if err != nil { return fmt . Errorf ( " " , err ) } for k , v := range kvMap { p := & api . KVPair { Key : k , Value : v } _ , err = c . consulKV . Put ( p , nil ) if err != nil { return fmt . Errorf ( " " , k , v , err ) } } return nil }
// Import takes a json byte array and inserts the key value pairs into consul prefixed by the namespace
Import takes a json byte array and inserts the key value pairs into consul prefixed by the namespace