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)
| 82 | // callers fall through to the normal path that will surface a |
| 83 | // proper error from the eventual load. |
| 84 | func 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`. |