blob: 1775ad641d95b995408ebf8103200acacd7a5d6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package config
/*
func formatENV() (string, error) {
if configPB == nil {
return "", errors.New("configPB not initialized")
}
var out string
uniques := make(map[string]*Config) // check to make sure there are no duplicate entries
for c := range configPB.IterAll() {
key := strings.ToLower(c.Key)
if len(strings.Fields(key)) != 1 {
log.Info("dropping invalid key = ", c.Key, "value =", c.Value)
continue
}
found := findByLower(key)
if found == nil {
log.Info("findByKey() got nil for key:", key)
}
// todo: warn about duplicates?
uniques[key] = found
}
for key, c := range uniques {
if c == nil {
log.Info("key has nil c", key)
continue
}
line := fmt.Sprintf("%s=%s", c.Key, c.Value)
out += line + "\n"
}
return out, nil
}
func findByLower(lookingFor string) *Config {
for c := range configPB.IterAll() {
if strings.ToLower(c.Key) == strings.ToLower(lookingFor) {
return c
}
}
return nil
}
*/
|