blob: 31d68011dd4e0a9402dabd0c4d84e012d39be314 (
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
|
package config
func Get(flag string) string {
if configPB == nil {
return ""
}
found := configPB.FindByKey(flag)
if found == nil {
return ""
}
return found.Value
}
func Set(key string, newValue string) error {
if configPB == nil {
return NotInitialized
}
found := configPB.FindByKey(key)
if found != nil {
found.Value = newValue
}
newvar := new(Config)
newvar.Key = key
newvar.Value = newValue
configPB.Append(newvar)
return nil
}
|