forked from rexray/rexray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
core.go
57 lines (51 loc) · 1.22 KB
/
core.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
53
54
55
56
57
package core
import (
"fmt"
"github.com/akutz/gofig"
"github.com/akutz/gotil"
"github.com/emccode/rexray/util"
)
func init() {
initDrivers()
gofig.SetGlobalConfigPath(util.EtcDirPath())
gofig.SetUserConfigPath(fmt.Sprintf("%s/.rexray", gotil.HomeDir()))
gofig.Register(globalRegistration())
gofig.Register(driverRegistration())
}
func globalRegistration() *gofig.Registration {
r := gofig.NewRegistration("Global")
r.Yaml(`
rexray:
host: tcp://:7979
logLevel: warn
`)
r.Key(gofig.String, "h", "tcp://:7979",
"The REX-Ray host", "rexray.host",
"host")
r.Key(gofig.String, "l", "warn",
"The log level (error, warn, info, debug)", "rexray.logLevel",
"logLevel")
return r
}
func driverRegistration() *gofig.Registration {
r := gofig.NewRegistration("Driver")
r.Yaml(`
rexray:
osDrivers:
- linux
storageDrivers:
- libstorage
volumeDrivers:
- docker
`)
r.Key(gofig.String, "", "linux",
"The OS drivers to consider", "rexray.osDrivers",
"osDrivers")
r.Key(gofig.String, "", "",
"The storage drivers to consider", "rexray.storageDrivers",
"storageDrivers")
r.Key(gofig.String, "", "docker",
"The volume drivers to consider", "rexray.volumeDrivers",
"volumeDrivers")
return r
}