MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / doCheck

Function doCheck

initialization.go:26–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24const unsetValue = "-"
25
26func doCheck() {
27 accessConf, unset := loadAccess()
28
29 drivers := pm3.List()
30
31 newAccess := 0
32 for _, p := range drivers {
33 if ac, ok := p.(pm3.AccessConfig); ok {
34 if len(ac.Access()) > 0 {
35 for asKey := range ac.Access() {
36 key := strings.ToLower(asKey)
37 if _, has := accessConf[key]; !has {
38 accessConf[key] = empty(key)
39 newAccess++
40 }
41 }
42 }
43
44 }
45
46 }
47 for asKey := range permit.All() {
48 key := strings.ToLower(asKey)
49 if _, has := accessConf[key]; !has {
50 accessConf[key] = empty(key)
51 newAccess++
52 }
53 }
54 if newAccess > 0 || unset > 0 {
55 f := accessFile()
56 fmt.Printf("%d access need set, see : %s and %s", newAccess+unset, saveTemplate(accessConf, f), saveCsv(accessConf, f))
57 }
58 os.Exit(0)
59}
60func accessFile() string {
61
62 if version == "" {

Callers 1

mainFunction · 0.70

Calls 8

loadAccessFunction · 0.85
emptyFunction · 0.85
accessFileFunction · 0.85
saveTemplateFunction · 0.85
saveCsvFunction · 0.85
AccessMethod · 0.80
ListMethod · 0.65
AllMethod · 0.65

Tested by

no test coverage detected