2018-02-05 16:05:59 -05:00
|
|
|
package config // import "github.com/docker/docker/cli/config"
|
2017-04-17 19:18:46 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/homedir"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
configDir = os.Getenv("DOCKER_CONFIG")
|
|
|
|
configFileDir = ".docker"
|
|
|
|
)
|
|
|
|
|
2017-06-01 16:34:31 -04:00
|
|
|
// Dir returns the path to the configuration directory as specified by the DOCKER_CONFIG environment variable.
|
2017-04-17 19:18:46 -04:00
|
|
|
// TODO: this was copied from cli/config/configfile and should be removed once cmd/dockerd moves
|
2017-06-01 16:34:31 -04:00
|
|
|
func Dir() string {
|
2017-04-17 19:18:46 -04:00
|
|
|
return configDir
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
if configDir == "" {
|
|
|
|
configDir = filepath.Join(homedir.Get(), configFileDir)
|
|
|
|
}
|
|
|
|
}
|