MCPcopy Create free account
hub / github.com/belak/gitdir / ensureSampleOptions

Function ensureSampleOptions

config_ensure.go:199–218  ·  view source on GitHub ↗
(targetNode *yaml.Node)

Source from the content-addressed store, hash-verified

197}
198
199func ensureSampleOptions(targetNode *yaml.Node) bool {
200 optionsVal, modified := targetNode.EnsureKey(
201 "options",
202 yaml.NewMappingNode(),
203 nil,
204 )
205
206 // Ensure all our options are on the options struct.
207 for _, opt := range sampleOptions {
208 _, added := optionsVal.EnsureKey(
209 opt.Name,
210 yaml.NewScalarNode(opt.Value, opt.Tag),
211 &yaml.EnsureOptions{Comment: opt.Comment},
212 )
213
214 modified = modified || added
215 }
216
217 return modified
218}
219
220func ensureAdminUser(data []byte, username, pubKey string) ([]byte, error) {
221 rootNode, modified, err := ensureAdminUserYaml(data, username, pubKey)

Callers 1

ensureSampleConfigYamlFunction · 0.85

Calls 3

NewMappingNodeFunction · 0.92
NewScalarNodeFunction · 0.92
EnsureKeyMethod · 0.80

Tested by

no test coverage detected