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

Method ensureAdminRSAKey

config_admin.go:41–54  ·  view source on GitHub ↗
(repo *git.Repository)

Source from the content-addressed store, hash-verified

39}
40
41func (c *Config) ensureAdminRSAKey(repo *git.Repository) error {
42 return repo.UpdateFile("ssh/id_rsa", func(data []byte) ([]byte, error) {
43 if data != nil {
44 return data, nil
45 }
46
47 pk, err := models.GenerateRSAPrivateKey()
48 if err != nil {
49 return nil, err
50 }
51
52 return pk.MarshalPrivateKey()
53 })
54}
55
56func (c *Config) loadAdminConfig(adminRepo *git.Repository) error {
57 configData, err := adminRepo.GetFile("config.yml")

Callers 1

ensureAdminConfigMethod · 0.95

Calls 3

GenerateRSAPrivateKeyFunction · 0.92
UpdateFileMethod · 0.80
MarshalPrivateKeyMethod · 0.65

Tested by

no test coverage detected