fix(server/registry): use url.Value.Encode()
Instead of open coding url encoding which lead to error, make it real and use the library.
This commit is contained in:
@ -56,7 +56,6 @@ angular.module('etcdBrowser', ['ngRoute', 'etcd', 'timeRelative'])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.key.get().success(function (data, status, headers, config) {
|
$scope.key.get().success(function (data, status, headers, config) {
|
||||||
console.log(data)
|
|
||||||
//hide any errors
|
//hide any errors
|
||||||
$('#etcd-browse-error').hide();
|
$('#etcd-browse-error').hide();
|
||||||
// Looking at a directory if we got an array
|
// Looking at a directory if we got an array
|
||||||
|
@ -38,14 +38,16 @@ func NewRegistry(s store.Store) *Registry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adds a node to the registry.
|
// Adds a node to the registry.
|
||||||
func (r *Registry) Register(name string, peerURL string, url string) error {
|
func (r *Registry) Register(name string, peerURL string, machURL string) error {
|
||||||
r.Lock()
|
r.Lock()
|
||||||
defer r.Unlock()
|
defer r.Unlock()
|
||||||
|
|
||||||
// Write data to store.
|
// Write data to store.
|
||||||
key := path.Join(RegistryKey, name)
|
key := path.Join(RegistryKey, name)
|
||||||
value := fmt.Sprintf("raft=%s&etcd=%s", peerURL, url)
|
v := url.Values{}
|
||||||
_, err := r.store.Create(key, false, value, false, store.Permanent)
|
v.Set("raft", peerURL)
|
||||||
|
v.Set("etcd", machURL)
|
||||||
|
_, err := r.store.Create(key, false, v.Encode(), false, store.Permanent)
|
||||||
log.Debugf("Register: %s", name)
|
log.Debugf("Register: %s", name)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user