MCPcopy Index your code
hub / github.com/belak/gitdir / loadAdminConfig

Method loadAdminConfig

config_admin.go:56–104  ·  view source on GitHub ↗
(adminRepo *git.Repository)

Source from the content-addressed store, hash-verified

54}
55
56func (c *Config) loadAdminConfig(adminRepo *git.Repository) error {
57 configData, err := adminRepo.GetFile("config.yml")
58 if err != nil {
59 return err
60 }
61
62 adminConfig, err := models.ParseAdminConfig(configData)
63 if err != nil {
64 return err
65 }
66
67 // Merge the adminConfig with the base config. Note that this will reset all
68 // values.
69 c.Invites = adminConfig.Invites
70 c.Groups = adminConfig.Groups
71 c.Orgs = adminConfig.Orgs
72 c.Users = adminConfig.Users
73 c.Repos = adminConfig.Repos
74 c.Options = adminConfig.Options
75
76 // Load the private keys
77 c.PrivateKeys = nil
78
79 keyData, err := adminRepo.GetFile("ssh/id_ed25519")
80 if err != nil {
81 return err
82 }
83
84 pk, err := models.ParseEd25519PrivateKey(keyData)
85 if err != nil {
86 return err
87 }
88
89 c.PrivateKeys = append(c.PrivateKeys, pk)
90
91 keyData, err = adminRepo.GetFile("ssh/id_rsa")
92 if err != nil {
93 return err
94 }
95
96 pk, err = models.ParseRSAPrivateKey(keyData)
97 if err != nil {
98 return err
99 }
100
101 c.PrivateKeys = append(c.PrivateKeys, pk)
102
103 return nil
104}

Callers 1

loadConfigMethod · 0.95

Calls 4

ParseAdminConfigFunction · 0.92
ParseEd25519PrivateKeyFunction · 0.92
ParseRSAPrivateKeyFunction · 0.92
GetFileMethod · 0.80

Tested by

no test coverage detected