-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
52 lines (42 loc) · 804 Bytes
/
config.go
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
46
47
48
49
50
51
52
package ajii
import (
"sync"
)
type BaseConfig struct {
sync.Mutex
v2KeysUrl string
serviceUrl string
foo string
Port int
}
type SimpleNode struct {
Key string
Value string
}
func (c *BaseConfig) GetFoo() string {
return c.foo
}
func (c *BaseConfig) SetFoo(f string) {
c.Lock()
defer c.Unlock()
c.foo = f
}
func (c *BaseConfig) Set(key string, value string) (string, error) {
return "", nil
}
func (c *BaseConfig) V2KeysUrl() string {
return c.v2KeysUrl
}
func (c *BaseConfig) ServiceUrl() string {
return c.serviceUrl
}
type Config interface {
Get(key string) (SimpleNode, error)
Set(key string, value string) (string, error)
Delete(key string) error
Dump() ([]SimpleNode, error)
GetFoo() string
SetFoo(f string)
ServiceUrl() string
V2KeysUrl() string
}