MCPcopy Index your code
hub / github.com/docker/docker-agent / StableSourceKey

Function StableSourceKey

pkg/config/resolve.go:137–152  ·  view source on GitHub ↗

StableSourceKey reduces a Sources map key to its stable identity: the part that persists across variant selectors and caller/environment metadata. For URL references the identity is the URL's path (scheme + host + path); the entire query string and fragment are treated as volatile. This is what let

(key string)

Source from the content-addressed store, hash-verified

135// identity when it resolves unambiguously, so collapsing distinct query strings
136// to one identity never silently selects the wrong side-by-side variant.
137func StableSourceKey(key string) string {
138 decoded, err := url.QueryUnescape(key)
139 if err != nil {
140 return key
141 }
142 if !IsURLReference(decoded) {
143 return key
144 }
145 u, err := url.Parse(decoded)
146 if err != nil {
147 return key
148 }
149 u.RawQuery = ""
150 u.Fragment = ""
151 return u.String()
152}
153
154// resolveDirectory enumerates YAML files in a directory and resolves each one.
155func resolveDirectory(dirPath string, envProvider environment.Provider) (Sources, error) {

Callers 3

resolveSourceMethod · 0.92
TestStableSourceKeyFunction · 0.85

Calls 3

IsURLReferenceFunction · 0.85
ParseMethod · 0.80
StringMethod · 0.45

Tested by 2

TestStableSourceKeyFunction · 0.68