make socket location configurable on cmd line

This commit is contained in:
Shaya Potter 2016-09-15 15:55:39 -07:00
parent 0681d5d94b
commit 3c0485dd71

View file

@ -14,8 +14,11 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
) )
var (
unixDomainSocket string
)
const ( const (
unixDomainSocket = "/var/run/ocid.sock"
// TODO: Make configurable // TODO: Make configurable
timeout = 10 * time.Second timeout = 10 * time.Second
) )
@ -233,6 +236,15 @@ func main() {
pullImageCommand, pullImageCommand,
} }
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "sock",
Value: "/var/run/ocid.sock",
Usage: "Socket to connect to",
Destination: &unixDomainSocket,
},
}
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {
log.Fatal(err) log.Fatal(err)
} }