configdir.go 520 B

12345678910111213141516171819202122232425
  1. package config
  2. import (
  3. "os"
  4. "path/filepath"
  5. "github.com/docker/docker/pkg/homedir"
  6. )
  7. var (
  8. configDir = os.Getenv("DOCKER_CONFIG")
  9. configFileDir = ".docker"
  10. )
  11. // Dir returns the path to the configuration directory as specified by the DOCKER_CONFIG environment variable.
  12. // TODO: this was copied from cli/config/configfile and should be removed once cmd/dockerd moves
  13. func Dir() string {
  14. return configDir
  15. }
  16. func init() {
  17. if configDir == "" {
  18. configDir = filepath.Join(homedir.Get(), configFileDir)
  19. }
  20. }