github.com/xeptore/docker-cli@v20.10.14+incompatible/cli/config/credentials/default_store.go (about)

     1  package credentials
     2  
     3  import (
     4  	exec "golang.org/x/sys/execabs"
     5  )
     6  
     7  // DetectDefaultStore return the default credentials store for the platform if
     8  // the store executable is available.
     9  func DetectDefaultStore(store string) string {
    10  	platformDefault := defaultCredentialsStore()
    11  
    12  	// user defined or no default for platform
    13  	if store != "" || platformDefault == "" {
    14  		return store
    15  	}
    16  
    17  	if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil {
    18  		return platformDefault
    19  	}
    20  	return ""
    21  }