2020-04-08 16:21:02 +02:00
package context
import (
"path/filepath"
2020-04-20 18:06:38 +02:00
"github.com/mitchellh/go-homedir"
2020-04-08 16:21:02 +02:00
"github.com/urfave/cli"
)
const (
// ConfigFileName is the name of config file
ConfigFileName = "config.json"
configFileDir = ".docker"
)
var (
2020-04-20 18:06:38 +02:00
ConfigDir string
ContextName string
ConfigFlag = cli . StringFlag {
2020-04-08 16:21:02 +02:00
Name : "config" ,
2020-04-15 16:55:30 +02:00
Usage : "Location of client config files `DIRECTORY`" ,
2020-04-08 16:21:02 +02:00
EnvVar : "DOCKER_CONFIG" ,
2020-04-20 18:06:38 +02:00
Value : filepath . Join ( home ( ) , configFileDir ) ,
2020-04-08 16:21:02 +02:00
Destination : & ConfigDir ,
}
ContextFlag = cli . StringFlag {
Name : "context, c" ,
2020-04-15 16:55:30 +02:00
Usage : "Name of the context `CONTEXT` to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with \"docker context use\")" ,
2020-04-08 16:21:02 +02:00
EnvVar : "DOCKER_CONTEXT" ,
Destination : & ContextName ,
}
)
2020-04-20 18:06:38 +02:00
func home ( ) string {
home , _ := homedir . Dir ( )
return home
}