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

Function loadAgentConfig

cmd/root/sandbox.go:84–97  ·  view source on GitHub ↗

loadAgentConfig is the shared best-effort loader: it resolves agentRef and loads the YAML, returning nil on any failure so callers fall through to the normal path that will surface a proper error from the eventual load.

(ctx context.Context, agentRef string)

Source from the content-addressed store, hash-verified

82// callers fall through to the normal path that will surface a
83// proper error from the eventual load.
84func loadAgentConfig(ctx context.Context, agentRef string) *latestcfg.Config {
85 if agentRef == "" {
86 return nil
87 }
88 source, err := config.Resolve(agentRef, nil)
89 if err != nil {
90 return nil
91 }
92 cfg, err := config.Load(ctx, source)
93 if err != nil {
94 return nil
95 }
96 return cfg
97}
98
99// userSandboxAllowlist returns the persistent host list the user has
100// taught docker-agent to open via `docker agent sandbox allow`.

Callers 4

TestPeekAgentSandboxFunction · 0.85
resolveSandboxDefaultFunction · 0.85

Calls 2

ResolveFunction · 0.92
LoadFunction · 0.92

Tested by 3

TestPeekAgentSandboxFunction · 0.68