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

Function ensureAdminUser

config_ensure.go:220–231  ·  view source on GitHub ↗
(data []byte, username, pubKey string)

Source from the content-addressed store, hash-verified

218}
219
220func ensureAdminUser(data []byte, username, pubKey string) ([]byte, error) {
221 rootNode, modified, err := ensureAdminUserYaml(data, username, pubKey)
222 if err != nil {
223 return nil, err
224 }
225
226 if !modified {
227 return data, nil
228 }
229
230 return rootNode.Encode()
231}
232
233func ensureAdminUserYaml(data []byte, username, pubKey string) (*yaml.Node, bool, error) {
234 rootNode, targetNode, err := yaml.EnsureDocument(data)

Callers 1

ensureAdminUserMethod · 0.85

Calls 2

ensureAdminUserYamlFunction · 0.85
EncodeMethod · 0.80

Tested by

no test coverage detected