mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
config: Add browser parameter (#3807)
browser new parameter receives "on" or "off" parameter which is similar to MINIO_BROWSER
This commit is contained in:
committed by
Harshavardhana
parent
c9619673fb
commit
9b3c014bab
24
cmd/utils.go
24
cmd/utils.go
@@ -23,11 +23,13 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/pkg/profile"
|
||||
)
|
||||
|
||||
@@ -238,3 +240,25 @@ 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user