-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
40 lines (35 loc) · 869 Bytes
/
main.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
package main
import (
"flag"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/docker/go-plugins-helpers/volume"
"os"
"path/filepath"
)
const (
VERSION = "0.12"
)
var (
defaultDir = filepath.Join(volume.DefaultDockerRootDirectory, "cinder")
)
func main() {
showVersion := flag.Bool("version", false, "Display version number of plugin and exit")
flag.Parse()
if *showVersion == true {
fmt.Println("Version: ", VERSION)
os.Exit(0)
}
cfgFile := flag.String("config", "/var/lib/cinder/dockerdriver/config.json", "path to config file")
debug := flag.Bool("debug", true, "enable debug logging")
flag.Parse()
if *debug == true {
log.SetLevel(log.DebugLevel)
} else {
log.SetLevel(log.InfoLevel)
}
log.Info("Starting cinder-docker-driver version: ", VERSION)
d := New(*cfgFile)
h := volume.NewHandler(d)
log.Info(h.ServeUnix("cinder", 0))
}