MCPcopy Create free account
hub / github.com/kubernetes/test-infra / LoadConfig

Function LoadConfig

label_sync/main.go:350–366  ·  view source on GitHub ↗

LoadConfig reads the yaml config at path

(path string, orgs string)

Source from the content-addressed store, hash-verified

348
349// LoadConfig reads the yaml config at path
350func LoadConfig(path string, orgs string) (*Configuration, error) {
351 if path == "" {
352 return nil, errors.New("empty path")
353 }
354 var c Configuration
355 data, err := os.ReadFile(path)
356 if err != nil {
357 return nil, err
358 }
359 if err = yaml.Unmarshal(data, &c); err != nil {
360 return nil, err
361 }
362 if err = c.validate(orgs); err != nil { // Ensure no dups
363 return nil, err
364 }
365 return &c, nil
366}
367
368// GetOrg returns organization from "org" or "user:name"
369// Org can be organization name like "kubernetes"

Callers 2

TestLoadYAMLFunction · 0.85
mainFunction · 0.85

Calls 1

validateMethod · 0.95

Tested by 1

TestLoadYAMLFunction · 0.68