MCPcopy Index your code
hub / github.com/coder/coder / Resolve

Method Resolve

coderd/runtimeconfig/entry.go:69–87  ·  view source on GitHub ↗

Resolve attempts to resolve the runtime value of this field from the store via the given Resolver.

(ctx context.Context, r Resolver)

Source from the content-addressed store, hash-verified

67
68// Resolve attempts to resolve the runtime value of this field from the store via the given Resolver.
69func (e RuntimeEntry[T]) Resolve(ctx context.Context, r Resolver) (T, error) {
70 var zero T
71
72 name, err := e.name()
73 if err != nil {
74 return zero, xerrors.Errorf("resolve, name issue: %w", err)
75 }
76
77 val, err := r.GetRuntimeConfig(ctx, name)
78 if err != nil {
79 return zero, xerrors.Errorf("resolve runtime: %w", err)
80 }
81
82 inst := create[T]()
83 if err = inst.Set(val); err != nil {
84 return zero, xerrors.Errorf("instantiate new %T: %w", inst, err)
85 }
86 return inst, nil
87}
88
89// name returns the configured name, or fails with ErrNameNotSet.
90func (e RuntimeEntry[T]) name() (string, error) {

Callers 4

TestEntryFunction · 0.45
GroupSyncSettingsMethod · 0.45
RoleSyncSettingsMethod · 0.45

Calls 4

nameMethod · 0.95
GetRuntimeConfigMethod · 0.65
SetMethod · 0.65
ErrorfMethod · 0.45

Tested by 1

TestEntryFunction · 0.36