Skip to content
Snippets Groups Projects
Commit f25c60fb authored by CodingSinger's avatar CodingSinger
Browse files

filter registry url params starting with dot

parent f1d03e95
No related branches found
No related tags found
No related merge requests found
......@@ -210,9 +210,9 @@ const (
// consumer
CONSUMER = "consumer"
// key of access key id
ACCESS_KEY_ID_KEY = "accessKeyId"
ACCESS_KEY_ID_KEY = ".accessKeyId"
// key of secret access key
SECRET_ACCESS_KEY_KEY = "secretAccessKey"
SECRET_ACCESS_KEY_KEY = ".secretAccessKey"
)
// metadata report
......
......@@ -22,9 +22,8 @@ import (
"strings"
"sync"
)
import (
"github.com/dubbogo/gost/container/set"
gxset "github.com/dubbogo/gost/container/set"
)
import (
......@@ -96,8 +95,24 @@ func getRegistry(regUrl *common.URL) registry.Registry {
func getUrlToRegistry(providerUrl *common.URL, registryUrl *common.URL) *common.URL {
if registryUrl.GetParamBool("simplified", false) {
return providerUrl.CloneWithParams(reserveParams)
} else {
return filterHideKey(providerUrl)
}
}
// filterHideKey filter the parameters that do not need to be output in url(Starting with .)
func filterHideKey(url *common.URL) *common.URL {
//be careful params maps in url is map type
cloneURL := url.Clone()
removeSet := gxset.NewSet()
for k, _ := range cloneURL.GetParams() {
if strings.HasPrefix(k, ".") {
removeSet.Add(k)
}
}
return providerUrl
cloneURL.RemoveParams(removeSet)
return cloneURL
}
func (proto *registryProtocol) initConfigurationListeners() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment