Simplify credential usage. (#3893)

This commit is contained in:
Bala FA
2017-03-16 12:46:06 +05:30
committed by Harshavardhana
parent 051f9bb5c6
commit 21d73a3eef
14 changed files with 225 additions and 169 deletions

View File

@@ -29,7 +29,6 @@ import (
"encoding/json"
humanize "github.com/dustin/go-humanize"
"github.com/minio/mc/pkg/console"
"github.com/pkg/profile"
)
@@ -255,28 +254,6 @@ func dumpRequest(r *http.Request) string {
return string(jsonBytes)
}
// Variant of getBrowserFromEnv but upon error fails right here.
func mustGetBrowserFromEnv() string {
browser, err := getBrowserFromEnv()
if err != nil {
console.Fatalf("Unable to load MINIO_BROWSER value from environment. Err: %s.\n", err)
}
return browser
}
//
func getBrowserFromEnv() (string, error) {
b := os.Getenv("MINIO_BROWSER")
if strings.TrimSpace(b) == "" {
return "", nil
}
if !strings.EqualFold(b, "off") && !strings.EqualFold(b, "on") {
return "", errInvalidArgument
}
globalIsEnvBrowser = true
return strings.ToLower(b), nil
}
// isFile - returns whether given path is a file or not.
func isFile(path string) bool {
if fi, err := os.Stat(path); err == nil {