MCPcopy Create free account
hub / github.com/docker/secrets-engine / parseXSecretLabel

Function parseXSecretLabel

x/injector/parser.go:27–36  ·  view source on GitHub ↗
(key, value string)

Source from the content-addressed store, hash-verified

25const xSecretPrefix = "x-secret"
26
27func parseXSecretLabel(key, value string) (string, string, error) {
28 if !strings.HasPrefix(key, xSecretPrefix+":") {
29 return "", "", fmt.Errorf("label does not start with x-secret: %s", key)
30 }
31 name := strings.TrimPrefix(key, xSecretPrefix+":")
32 if !strings.HasPrefix(value, "/") {
33 return "", "", fmt.Errorf("%s is not an absolute path", value)
34 }
35 return name, filepath.ToSlash(value), nil
36}
37
38func SecretMapFromLabels(labels map[string]string) map[string]string {
39 result := make(map[string]string)

Callers 1

SecretMapFromLabelsFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected